I want to subtract the value of a process variable from a specific field and process the result by branching.

I am a beginner with Appian. In the interface, I input values for each field of a record type and save them to process variables. In the process model, I want to reference the same record, subtract a specific field from the corresponding process variable, and perform the following actions:

If the result is 0 or below, I want to send an email without changing the value.
If the result is 1 or above, I want to save the calculated result in a process variable and send an email.
Can you guide me on how to achieve this in Appian?

  Discussion posts and replies are publicly visible

Parents
  • So like any development in any language you'll need to break this down into discrete pieces of code (objects in the case of Appian). I encourage those on my Dev teams to create micro-designs for their features (I do this myself - it often saves me from going down  an wrong path when developing the code)

    • User Interface - you don't say how a User will initially access this User Interface. So that's missing from your description above. But once in the UI you'll need to have input fields that match the type of data for each of the record type attributes that you want to process. These should be mapped to the Interface's rule inputs and made available to the process model's variables. 
    • Process Model - once you have the values the user entered in the Interface now in your process variables you can then use a Script Task to perform the subtraction as you describe. Since in one of you possible outcomes you need access to the result of this calculation you'll need the Script Task to store the result in another process variable. I suggest you consider a naming scheme that makes it clear what the original value is, what the user-entered value is and what the result is (e.g <record type>.<attributeName>, <attributeNameUserValue>, <attributeNameResult>
    • Since you're going to send an email either way you don't need to branch the process flow (no XOR required) but what you do want to do is set the value you're going to use in that email according to the rules you outline. Use a Script Task to write the desired value to the <attributeNameResult> process variable and use this in your Send Email smart service

  • Thank you for your response.

    I have a basic question regarding the process model, and I apologize if it seems elementary. I am struggling to understand how to reference a specific record within multiple records in a record type.

    Specifically, I would like to know how to reference the same record as the one set in a process variable. My goal is to subtract values from the process variable based on the current value of a specific field.

    To clarify this issue, I would greatly appreciate your guidance. 

    Best regards,

Reply Children
No Data