Jump to content

Recommended Posts

Posted

I'm trying to update a User Defined Dimension on the AP Bill Detail based on the value of the account number used.

Trigger: Before Create, Before Update
On field Change: Any update
Record: AP bill detail
Field to change: Restriction

Change Formula:

let [accountNum,nothing] = "{!APBILLITEM.ACCOUNTNO!}".split("-");
if(accountNum >= 50000){
  return 10002;
}

I've verified it's running, and the formula works as it will successfully update the Memo field. However, when I try to update the dimension, it doesn't update. I tried the update via Postman using 10002 for the value of the User Defined Dimension, and it updates correctly.

Is this a limitation of triggers?

Posted (edited)

I tried to do that, but I think I started a recursive loop. The API called caused the trigger to fire and since the trigger is on the APBILLITEM which is what the API is updating, it caused the API to trigger again. Here the API call:

<update>
        <APBILL>
          <RECORDNO>{!APBILLITEM.RECORDKEY!}</RECORDNO>
          <APBILLITEMS>
            <APBILLITEM>
                <RECORDNO>{!APBILLITEM.RECORDNO!}</RECORDNO>
                <AMOUNT>{!APBILLITEM.TRX_AMOUNT#value!}</AMOUNT>
                <ACCOUNTNO>{!APBILLITEM.ACCOUNTNO!}</ACCOUNTNO>
                <LOCATIONID>{!APBILLITEM.LOCATIONID!}</LOCATIONID>
                <VENDORID>{!APBILLITEM.VENDORID!}</VENDORID>
                <PROJECTID>{!APBILLITEM.PROJECTID!}</PROJECTID>
                <GLDIMRestriction>10002</GLDIMRestriction>
            </APBILLITEM>
          </APBILLITEMS>
        </APBILL>
</update>

What I'm attempting now is a "Update Field Value" trigger. Here is a screenshot: image.thumb.png.60d55975c0af14a8a70dc90484f98f70.png

Edited by Josh Kenzer
  • 1 month later...
  • Members
Posted

Josh,

Couldn't you use a dimension relationship here rather than trying to create a trigger? If you use a trigger I think you will have to run it in offline mode for it to work. I would also select the "After create" option for this.

×
×
  • Create New...