Hi Team,
Please help me to understand the expected result of triggers workflow action here. I add a "Create record" trigger to "Run selected triggers" workflow Action. In the meantime, I added the below condition to the trigger to avoid duplicated data. However, there are still 2 identical records created at the same time when the action is proceed.
var m_Name = '{!name#text}';
var isResellerExist = rbv_api.selectQuery("SELECT name FROM Reseller where name=?", 1, m_Name);
if ("{!Potential#value}" === "Reseller" && isResellerExist.length <= 0) {
return true;
}
else return false;
Further to that, I found the duplicates only happen when I set On Field Change "Any updates". But if I set On Field Change to be "Workflow Action" or "Workflow status", no record will be created. It looks like the action will trigger before the status changed?
Hi Caylali,
The script that you were using to restrict duplicate values in "Reseller" object is working fine. I assume that you are using this script in workflow action instead of the trigger itself.
I have verified by using your script in "create record trigger and tested by changing "onFieldChange" to "Any Updates" as well by changing "onFIeldChange" to "Workflow Actions"/"Workflow status". Please correct me if I understand your requirement correctly.
Regards,
Shiva