Hi Dears!!!...
I am trying to create sales order from a web application using NAV web services. And i need NAV to generate Sales Order No based on user Store location. I have provided No. Series setup based on Store location. and i am passing Store Location also along other order details in header(customer no, order date... etc) through web services. and upon calling CREATE(ref objSO), Store location seems blank in NAV Table 36 ONInsert trigger.
dont understand why its blank. please any help...
Only primary key values will be available inside NAV ONInsert trigger?
please help me to find a solution to generate sales order No. series based on Store Location passed through webservice.
Thank you,
aav!o
0
Comments
I believe that this is a feature (even though I have not found it in any documentation). When I tested it in multiple scenarios the service.Create always called in NAV INSERT first for primary key columns only and MODIFY for the rest afterwards. This behaviour did not change even with delayed Insert nor in NAV2013.
Therefore my suggestion would be to create and expose a codeunit with function that will create the sales header for you and process it via page only once the sales order exists. Alternatively you may use XMLPort via web service to import sales order.
Regards, Igor
If your SO no. want to follow base on your setup you can modify at T36 - GetNoSeriesCode(). Or you can set "No. Series" when you create Order by ws.
eg.
_saleshdr.No_Series = "SO";
_ws.Create(ref _saleshdr);
Regards,
Yukon
_saleshdr.No_Series = "SO";
_ws.Create(ref _saleshdr);
but still No. Series seems to blank on OnInsert trigger. i am getting error messages like that.
It ends with "aaaa" is not a No. Series... it means that the value is transfered correctly. Of course, I just needed add the No. Series field to the page and se the EDITABLE property to TRUE for it.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
i tried as you have mentioned. but still No. Series is blank.
what may be the issue? plz help.
on salesheader table onInsert trigger i have the code
suppose if i hardcode No series as lvOrderNo := NoSeriesMgt.GetNextNo('874SO',TODAY,TRUE)
its working!! and "No. Series" in header is updated.
ie, When control is in OnInsert trigger "No. Series" blank.
how to correct it....... ](*,)
So, if you want to your no. is following No. Series you may need to use Code Unit and publish. We can be set No. Series but no. is not follow our no. series.
You can check this way for your No. Series is pass or not.
If i not mistaken better way is Igor's suggestion.
Regards,
Yukon
I noticed this as we implemented CRM Connector for NAV on custom pages. If you want to insert a job order then you can not execute code where it really needs to be an order. Status field will always be empty (=quote) OnInsert.
With kind regards
mik
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
back to your sample:
Yes, this code complains about non-existent no. series. But it still seems to process the Create action in the following steps internally:
1) Populate Primary Key columns from the request.
2) INSERT(TRUE)
3) Populate all other fields
4) MODIFY(TRUE)
whereas I often wanted it to process it in the following way (or at least when Delayed insert is used):
1) Populate all fields.
2) INSERT(TRUE)
I have spent quite some time trying to persuade standard NAV page to process it in different way but without success. If you want to really test that it works as I said, put the TESTFIELD on No. Series into OnInsert. I very much believe it will be blank and in your example it complains on non-existing No. Series in step (3).
Regards,
igor
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.