Jump to content

Recommended Posts

Posted

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

Posted

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.

Posted

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>

 

×
×
  • Create New...