Ember Robb Posted October 31 Posted October 31 I'm currently trying to get a custom field on an order entry transaction line to populate when the order entry is created. I have written a API call inside the event's body that goes as such: <update_sotransaction key="{!SODOCUMENTENTRY.DOCHDRID!}"> <updatesotransitems> <updatesotransitem line_num="{!SODOCUMENTENTRY.LINE_NO!}"> <customfields> <customfield> <customfieldname>CUSTOM_FIELD</customfieldname> <customfieldvalue>{!SODOCUMENTENTRY.EMPLOYEE.CUSTOM_FIELD!}</customfieldvalue> </customfield> </customfields> </updatesotransitem> </updatesotransitems> </update_sotransaction> There's one big problem with this: SODOCUMENTENTRY.LINE_NO starts at 0, but I need it to start at 1. In my own integration with Sage, I simply append 1 to the returned order entry line to update the correct order entry. Is that possible to do in a Smart Event? I haven't been able to find an example of how to use the API to update a order entry transaction line via a Smart Event. Any guidance on this would be appreciated. Thanks, Ember
Lee Savidge Posted November 1 Posted November 1 I've hit similar problems here. The way to deal with this is when the record is created, copy the line_no + 1 value to a custom field and use that. You will need to manage that value on changes and updates though because the line-no does change if you reorder the lines or remove/add lines.
Lee Savidge Posted November 1 Posted November 1 Saying that, I just read this article: So maybe this? To be fair, I did mine a long time ago and using the custom field works. I didn't know this and I don't know if it works. Give it a whirl. It it does, give @Preston, Charlie a thumbs up. <update_sotransaction key="{!SODOCUMENTENTRY.DOCHDRID!}"> <updatesotransitems> <updatesotransitem line_num="#EVAL[ return 1 + {!SODOCUMENTENTRY.LINE_NO!} ]"> <customfields> <customfield> <customfieldname>CUSTOM_FIELD</customfieldname> <customfieldvalue>{!SODOCUMENTENTRY.EMPLOYEE.CUSTOM_FIELD!}</customfieldvalue> </customfield> </customfields> </updatesotransitem> </updatesotransitems> </update_sotransaction>
Ember Robb Posted November 1 Author Posted November 1 Thanks for the suggestion @Lee Savidge but unfortunately it did no work. I'll either go for the custom field option you suggested or I might write my own integration instead.
Recommended Posts