5 Replies Latest reply on Mar 19, 2019 12:55 PM by Laurent Matheo

    How to update a Record field with a process in Innovation?

    Emmanuel Abarca
      Share:|

      Hi there, I have a Record definition called Attachment where I can have up to 3 attachments (Field names: Attachment 1, Attachment 2 and Attachment 3), also I have a field called "Attachment Count" where I want to show with a number in a Record Grid how many attachments does my instance have just after I have created it and its default value is 0. So this Attachment Count value should be updated automatically with the correct number of attachment files when the "Save button" have been pressed with a "Launch Process Action" (for the counting) that will follows a "Save Action" so the process could be applied to the instance I have just created.

       

      The form for creating a new Attachment instance looks like this:

      Formulario.png

      And I am taking the following value "Record Editor > Record Instance > ID" for the INPUT MAP of the following process..

       

      proceso.png

      This was my idea of a process that will validate if each of the 3 attachment fields is empty or not, so in the 1st gateway I was asking if "Attachment 1" = NULL then go to the next gateway which does the same but with the Attachment 2 and so on. But I have no idea if the syntax of the condition is correct or if I am using the correct "Attachment 1" value.

       

      In each of the "Update Record Att#" I was trying to do something like "Attachment Count + 1" in that specific field but again I dont know the exact syntax for that or if something like that could work. I dont even know if I need the "Get Record" activity because I am already asking for the ID of my instance with an input variable in the process which seems to be enough.

       

      I am kinda new with Innovation Studio and I would be really grateful with any help. The most specific the better.

       

      Thanks!!

        • 1. Re: How to update a Record field with a process in Innovation?
          Laurent Matheo

          I guess you could have a process variable:

          2019-03-14_18-21-05.png

           

          And you can use an "Compute Value" activity to do the calculation:

          2019-03-14_18-21-53.png

           

          So you want to do something like:

          attachmentCounter = attachmentCounter + 1

           

          In the end you will have this:

          2019-03-14_18-23-02.png

           

          In detail, you do the calculation in "Expression Text" (attachmentCounter + 1):

          2019-03-14_18-25-02.png

           

          Then the "Compute Value" activity "Output" will contain the result, so you could say that:

          "compute value.Output" = attachmentCounter + 1

           

          That is why in the "Output Map" you assign the variable attachmentCounter to the Output:

          2019-03-14_18-26-44.png

          In detail for "Source":

          2019-03-14_18-27-24.png

           

          So in the end it is kinda like:

          "compute value.Output" = attachmentCounter + 1

          attachmentCounter = "compute value.Output"

           

          Then once you have your attachmentCounter you can just use a "Update Record" activity to update your counter field with the variable value.

          Here I mapped the "Description" field with the "attachmentCounter" value. Of course you will need to adapt in your case.

          The Record Id is also a "dummy" one, you will have to use the real record Id (Guid for example).

          2019-03-14_18-29-28.png

          1 of 1 people found this helpful
          • 2. Re: How to update a Record field with a process in Innovation?
            Emmanuel Abarca

            Edit: Nevermind, I just realized that I can´t use the same instance ID in to consecutive processes in my "Save button" and that was why I was getting the ERROR 920, so I will figure it out how to combine both processes but I still could use some orientation with my "Attachment 1 = NULL" condition.

             

            ---------------------------------------------------------------------------------------------------------------------

             

             

             

            Hello Laurent,

             

            Thank you so much for your answer, I totally understand your solution but when I try to implement it without any condition or gateway (just trying to update my Attachment Count field to 1) I am getting this error message:

            Sin título 2.png

            The first line should say something like this in english: A new line has been detected in the checker in quotation marks. And in my process I am already asking for a recordID as an input and setting it up correctly in my UpdateRecord Activity as well as the correct Record Definition Name, I dont know what I am missing.

             

            Also if everything turns ok when I will try to validate if my Attachment fields are empty, is this syntax correct?

            Sin título.png

            "Attachment 1" is the field of Type Attachment where I will upload my files and then with this process check if they are empty or they have a file. So this condition should be in an Exclusive Gateway.

             

            Again, thank you so much.

            • 3. Re: How to update a Record field with a process in Innovation?
              Laurent Matheo

              I would have to check for the attachment condition.

              As for the save, I wonder if you could use a Rule triggered on "After Create". This way your record should have been saved in database when the rule will fire.

              1 of 1 people found this helpful
              • 4. Re: How to update a Record field with a process in Innovation?
                Emmanuel Abarca

                Thank you so much for your anwer Laurent,

                 

                I have actually succesfully combined the two processes I wanted to use into a single one, and the condition to validate if the attachment is empty works as it should without any error.

                 

                The Compute Value Acitvity and its configuration was everything I needed to make my process work as I wanted just after realizing that I can not use two consecutive processes in the same buttom.

                 

                Thank you again and have a nice day!