Reply To: Show notification on new form based on lookup column

Forums Dynamic Forms for SharePoint Show notification on new form based on lookup column Reply To: Show notification on new form based on lookup column

#8521

Alexander Bautz
Keymaster

Sorry for the delay – it seems I’m not getting all the notifications from my forum.

I have a list “Customers” with the customer name in the Title field, and a field “ServiceContract” that may contain the text “PO Required”.

Then I have a lookup form my DFFS enabled form into the “Customers” list in the Title field – pulling in the customer name.

Then I have this rule in DFFS NewForm: Customer is changed > Run these functions = customerChanged (see attached image).

In the custom js tab, I have this code:

function customerChanged(){
	var sVal = $("#dffs_Customer").find("option:selected").val(), res;
	res = spjs_getItemByID({"listName":"Customers","id":sVal,"viewFields":["ServiceContract"]});
	if(res !== null){
		if(res.ServiceContract === "PO Required"){
			spjs.dffs.dlgBox("This customer requires a PO.",true);
		}
	}
}

Change “Customer”, “Customers” and “ServiceContract” to match your field and list name.

Please note that this code example uses “spjs.dffs.dlgBox” added in v4.350 – change this to an “alert(…)” if you use another version.

Hope this helps,
Alexander

Attachments: