Josh Kenzer Posted August 27, 2024 Posted August 27, 2024 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?
Josh Kenzer Posted August 28, 2024 Author Posted August 28, 2024 Any other method I've come up with to achieve this will cause a recursive loop. Any ideas on how to achieve this? @Louis Sterio2
Members Sterio, Louis Posted August 28, 2024 Members Posted August 28, 2024 Is this attempting to execute an API call in a document template? Can you provide the API call that is attempting to run?
Josh Kenzer Posted August 28, 2024 Author Posted August 28, 2024 (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: Edited August 28, 2024 by Josh Kenzer
Members Sterio, Louis Posted October 23, 2024 Members Posted October 23, 2024 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.
Kathy Jastrzebski Posted October 30, 2024 Posted October 30, 2024 Thanks for posting this question and solution. I had the same issue with a GLENTRY trigger to populate a UDD and setting the trigger to run offline solved it. Thanks again!
Recommended Posts