I am using dynamics ax 2012. In which I want to refresh parent from from child form.
On parent form of purchase agreement when I click create order button It opens create order child form.
Once adding inputs here I click create order button. which runs batch job and creates purchase order.
For my requirement I want to refresh parent form when I click on this create order button on child form.
If you schedule a batch and immediately refresh the form, it means that you refresh the form before the batch runs and creates an order. Is it what you want?
Yes.
When batch job runs same code disables release order button.
As parent form is not refreshing release order button stays enable on form and user able to release duplicate order. To avoid this I want to refresh parent form when user clicks create order button on child form.
You confirmed that the batch job will run after your refresh, but you’re also saying that the refresh should fix something done by the batch (which hasn’t run yet). It doesn’t make sense to me. Either you want to do something after the batch completed, but then you must wait for it, or you want to run code independently on the batch. You can’t have both.
Also, your description reveals that you didn’t analyze the problem properly. You don’t really know why the button is disabled - you should figure it out before you can start designing a solution. If you need our help with it, you’ll make it easier for us if you share the element names with us.
Can you provide me a code to refresh parent form when I click on create order button on child form?
I can’t, because there is nothing like refreshing a form. You can refresh or research a data source, but it’s not clear whether it would help with your requirement. Also, writing such code would be a waste of time if it can’t solve anything (you confirmed that your code would execute before the action you want to react to).
Just writing code without knowing what code you actually need doesn’t sound like a good idea to me.