Trigger action create 2 identical records.

Posted by caylali on 29-Feb-2016 21:41

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;

All Replies

Posted by caylali on 29-Feb-2016 23:02

Hi Team, I found it quite unpredictable. I tried the same trigger and action several times, sometimes only one record created as I want it to, but sometimes duplicate records created.

Posted by caylali on 29-Feb-2016 23:36

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?

Posted by Shiva Duriseati on 04-Mar-2016 03:48

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

This thread is closed