5 Replies Latest reply on Dec 13, 2017 3:46 PM by AlasdairRobertson

    Request Form Development: Default a dropdown list

    ggarcia@marchofdimes.org Apprentice

      Hey all, I have what is probably a simple question.

      I created a dropdown field on a request form and want it to display a list of all of our employees and default to the logged in user.

      No problem setting up the PickList: Validation List using the Employees table and the Title Field of Display Name - this works great.

      Where I ran into the problem was in trying to default the list to the current user.  I don't know the differences so I tried a few things that all failed:

      1. Function: Current User: Display Name
      2. Expression: Current User: Display Name: CurrentUserField("DisplayName")
      3. Expression: Current User Functions: Current UserDisplay Name: CurrentUserDisplayName()

      When previewing, all 3 pull the current user, but there is an error by the field which indicates that the field has an incorrect value.

       

      Any advice?

        • 1. Re: Request Form Development: Default a dropdown list
          MarkLarvo Specialist

          Hi G, (I think I know what you are after since we are on a parallel path you actually have to use another hidden field on your form to store the RecId of the name selected.)

           

          We are using the following in an SR:

           

          Field Name: Reported For:

          - Default Value (expression): CurrentUserField ("DisplayName") : (I set this for the logged in user by default but allow them to change it to their assignment.)

          - Visible: if CurrentUserRole() == "Self Service" then true else false

          - Pick List: Validation list "Employees", Title Field "Display Name"

          - Unique ID: FFReportedFor (I use FF for form field)

           

          Field Name: Reported By:

          - CurrentUserDisplayName

          - Visible: if FFReportedFor.selected.Employee.DisplayName == CurrentUserDisplayName() then false else true (Only if they change the name in Reported For do we display their name as confirmation)

          - Pick List: see above

          - ReadOnly: Yes

           

          Here's the trick

          Field Name: ReportedForRecId

          - Default Value:  FFReportedFor selected.Employee.RecId

          - Field Visible: No

          - Unique ID: FFReportedForRecId

           

          REPEAT THIS FOR "ReportedBy"

           

          In your workflow, set the following using an Update Block: (Use the Overwrite checkbox)

          Contact Link: $(GetSRPValue(RecId,  "FFReportedForRecID"))

          ProfileLink_Category: Employee

           

          AlternateContactLink: $(GetSRPValue(RecId,  "FFReportedByRecID"))

          AlternateContactLink _Category: Employee

           

          This should get you the variables you need and set up the new SR with the names from your form. I beat my head on this for several weeks so I hope this will save you time.

           

          Good luck - Mark. ;-)

          • 2. Re: Request Form Development: Default a dropdown list
            AlasdairRobertson ITSMMVPGroup

            you need to use the CurrentLoginId() function for this. Typically the pick list for Employee uses the LoginId as the value field not the display name as shown below:

             

             

            So to use the list in an SR you just need to call it as so:

             

             

            And set the validation/pick list to use:

             

             

            Thats it when you go to log a new request it will auto populate with the current users details:

             

            If you get stuck just shout.

            • 3. Re: Request Form Development: Default a dropdown list
              ggarcia@marchofdimes.org Apprentice

              Aha! Many thanks to both of you!

              • 4. Re: Request Form Development: Default a dropdown list
                ggarcia@marchofdimes.org Apprentice

                Sorry for all the questions, but what do these fields do?

                • Contact Link: $(GetSRPValue(RecId,  "FFReportedForRecID"))
                • ProfileLink_Category: Employee
                • AlternateContactLink: $(GetSRPValue(RecId,  "FFReportedByRecID"))
                • AlternateContactLink _Category: Employee

                 

                On our incidents and service requests we only have a customer field - assuming that is standard, but not sure.

                • 5. Re: Request Form Development: Default a dropdown list
                  AlasdairRobertson ITSMMVPGroup

                  There is a hidden reported By field on both objects, this is for those who wish to logged who the request is for and who logged it for example a PA logging a ticket for a director.  Both parties could then be notified at each step in the process.

                   

                  Fields:

                  • Contact Link, alternate contact link and profile lunk would all link back to the employee object each with its own relationship.  These field hold RecId and usually form 2 fields in the database ProfileLink_RecId (record identifier in the related object) and ProfileLink_Category (name of related object)
                  • ProfileLink_Category: ProfileLink_Category (name of related object) in this case Employee.

                  Commands:

                  • $(GetSRPValue(RecId,  "ParameterFieldName")) - this grabs a parameter value form the current service request being considered by the workflow or quick action.