2 Replies Latest reply on Jun 29, 2018 1:37 PM by Jeff.Bromberger

    How to use a function in the UIAction QuickAction block?

    Jeff.Bromberger Apprentice

      I'm working on a quickaction where there is a UI Action involved - the creation of a new business object.  I am working in the Command Data block, and I hit a wall every time I want to use something other than a simple field as a value.  My block looks like this:

       

      {
        ObjectType:'ServiceReq#',
       'Fields': [
              {'Name': 'ProfileLink_Category', 'Value': '$(if IsReportedByAlternateContact then AlternateContactLink_Category else ProfileLink_Category)'},
              {'Name': 'ProfileLink_RecID', 'Value': '$(if IsReportedByAlternateContact then AlternateContactLink_RecID else ProfileLink_RecID)'},
              {'Name': 'OwnerTeam', 'Value': '$(CurrentUserTeam())'},
              {'Name': 'Owner', 'Value': '$(CurrentLoginId())'},
          ]
      }
      

       

      But in each place, the system complains that the "value" is not a valid field in the parent object (Incident in this case).  Now, if I just use plain values, it works:

       

      {
        ObjectType:'ServiceReq#',
       'Fields': [
              {'Name': 'ProfileLink_Category', 'Value': '$(ProfileLink_Category)'},
              {'Name': 'ProfileLink_RecID', 'Value': '$(ProfileLink_RecID)'},
              {'Name': 'OwnerTeam', 'Value': '$(OwnerTeam)'},
              {'Name': 'Owner', 'Value': '$(Owner)'},
          ]
      }
      

       

      Now I am looking for the simple clue to what I missed here.  There must be a simple solution here...

       

      Thanks in advance!

       

      j

        • 1. Re: How to use a function in the UIAction QuickAction block?
          Jonathan.Schmidt SupportEmployee

          Hi Jeff,

           

          I've never seen anyone do anything more than a simple field call in the UI Action commands.  I'm not sure it can process the if statement.  If I were doing this I'd make two identical quick actions and modify one for the Alternate Contact Link = True situation, then on the quick action definitions hide / show each based on that boolean value.  To the end user it'll appear to be the same button / action, but behind the scenes you swap it out according to the situation.

           

          Just an idea, hope it helps!

           

          Jon

          • 2. Re: How to use a function in the UIAction QuickAction block?
            Jeff.Bromberger Apprentice

            First off, thanks so much for the reply!

             

            I guess what I was pointing out is that there is no '$' processing in the Value tag.  Even the builtin functions (see the last two lines of my cut example) do not function as expected.  If that's the case, then there may be no way to fill something in based upon the current user.

             

            The real problem is that the system is not set up to make this Service Request a child, which is why I'm calling an Insert Object and not Insert Child Object.  And since this is an unlinked object, there's no way to go back in for an update, since there's no returned handle.

             

            Then, to put more gasoline on the fire, once you create the new ServiceReq, you technically can't update it, since it hasn't been saved the first time to the database.  I need a way to correctly populate the ticket the first time, not go back in and touch it up.  :-(