Show notification on new form based on lookup column

Home Forums Classic DFFS Show notification on new form based on lookup column

Viewing 5 reply threads
  • Author
    Posts
    • #8498
      Charlie Bell
      Participant

        My situation is i have a cases list and on creating new cases a user will select a customer with drop down. Based on Value customer selected it should read a column in customer list called Service Contract if the value of this column is PO Required then show a notification that says Please note this customer requires a PO to save ticket.

        SO i have my main list Cases with a lookup called Customers

        I have Customers list which holds the column Service Contract this is a choice field

        Ideally i would love to make the PO filed on cases required if this is true and message is displayed not sure if that would be possible.

        Any help in the right direction to accomplish this would be great.. thanks..

      • #8514
        Charlie Bell
        Participant

          Anyone have any luck with this???? need to use associated lookup in a rule for a few items.. anyone?????

        • #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:
          • #8538
            Charlie Bell
            Participant

              Thanks a bunch it seems to be working i tried it before i upgrade and i only get the Type error when function returns true…. so thanks a bunch now i just need to upgrade the site i have a bunch of custom stuff what should i backup to be safe or should i do anything special during the upgrade i didnt see anything in the install guide so figure its kinda like the normal dffs upgrade… coming from 4.306

              thanks again for the help

            • #8550
              Charlie Bell
              Participant

                res = spjs_getItemByID({“listName”:”Customers”,”id”:sVal,”viewFields”:[“Service_x0020_Contract”]});

                could i possible change this to lookup a list on another site????

              • #8552
                Charlie Bell
                Participant
                  res = spjs_getItemByID({"listName":"Accounts","listBaseUrl":"/Intranet/crm","id":sVal,"viewFields":["Contract"]});

                  In case anyone else needs this here is the trick for a cross site lookup column

              Viewing 5 reply threads
              • You must be logged in to reply to this topic.