J
jsniemi79
Guest
I have written a trigger to update a text field on my user with a pipe delimited list of values from a related object. I'd like the end result to be in the this format: "value|value|value...". When I run the debug on my code using the println, I get exactly what I was expecting. However, when I run the trigger on the object, it adds a value of "null" before the first pipe. Here is the code for my trigger: rbv_api.setFieldValue("USER", {!id}, "subordinate_sales_agents", ''); {!#LOOP_BEGIN.ORG_CHART} var AcctID = rbv_api.selectQuery("SELECT sales_agent_id#value FROM agility_user_data WHERE agility_login = ?", 1, '{!ORG_CHART#C.loginName}'); if (AcctID.length == 1) { var SA1 = rbv_api.getFieldValue("USER", {!id}, "subordinate_sales_agents"); var SA2; if (SA1 != '') { var SA2 = SA1 + '|' + AcctID[0][0]; } else { var SA2 = AcctID[0][0]; } rbv_api.setFieldValue("USER", {!id}, "subordinate_sales_agents", SA2); } {!#LOOP_END.ORG_CHART} var text = rbv_api.getFieldValue("USER", {!id}, "subordinate_sales_agents"); rbv_api.println(text); Here is the screenshot of the debug on my system: Here is the value on my user after the trigger was executed:
Continue reading...
Continue reading...