Is there a way to use a workflow condition to chec...
# suiteflow
j
Is there a way to use a workflow condition to check a field against all previous entries of that field to see if it's a duplicate? In other words, user fills in "123ABC" in reference number on 11/20 and then has another transaction where they type in "123ABC" in the reference number on 12/11--triggering a warning message. I think a script would be easier/faster, but I've been told to make it work as a workflow.
n
One approach I took with Workflow was to have a text field on the Customer. In this field I concatenated each new PO number to create a ‘history’. Each new SO is then checked by After Field Edit Workflow to see if the new number is in the Customer’s history. Throws an alert at time of duplicate entry.
s
a workflow cannot compare one record to another so this is not going to be possible in a workflow.
j
Interesting approach, @Netsuite Tragic. I think honestly a script is just going to be better overall. I'm not great at them, but we'll see what I can do.
n
@Sean Murphy I recall the technique I used was to load the 'history' field as a WF Field. Then do the comparison within the WF.
j
@Netsuite Tragic How did you accomplish filling a field with all results from a search? I can't get this script to work, so I'm up against a wall.
n
It was quite a while ago I did this. This is the AfterSubmit script
function updateRecentOrders(type){
var soEntry = nlapiGetFieldValue('otherrefnum');
nlapiLogExecution('DEBUG', 'soEntry length', soEntry.length);
if(soEntry.length !==0){
//Obtain the following value from the SO
var customerID=nlapiGetFieldValue('entity');
nlapiLogExecution('DEBUG', 'Cust InternalID', customerID);
//Most Recent SOs
var recentSO = nlapiLookupField('customer',customerID,'custentity_most_recent_so');
recentSO = recentSO.substr(0,75);
nlapiLogExecution('DEBUG', 'Recent SO', recentSO);
//Append new SO to the existing Recent SO
recentSO =soEntry+' '+recentSO;
//Write new Most Recent POs to Customer record
nlapiSubmitField('customer', customerID, 'custentity_most_recent_so', recentSO);
}
}
j
Oh, so it still takes a script?
n
That's how I did it at the time. Others may have other ideas.
n
have you resolved this?