Repeating Emails based on an Array

Hi,

I have a CDT with claim information. This cdt has the claim start date and the claimant information such as name and email and the claim expiry date along with other details. We have to retrieve all the claims that exceeded 30 days in the system with claim status still as open and alert the claimant that it is pending.

I have written a rule to get such claims from the database and am able to access them in the Process Design and for the send Email activity after the Script Task, I have enabled multi node from the other tab.

Now, I am not able to customize with each iteration which user the notification should go to and customize the information in the body of the email.

I am trying to see if pv!ClaimInfo_cdt.customerEmailID will work in the To field of the Email smart service, but not sure how to access the index while the multi node is iterating on each record in the CDT array.

Hope my question is clear. I am new to Appian and I am facing this difficulty.

 

Thanks,

Adi

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer
    Hi Adi,

    In order to access the each record from an array which is running in an MNI(Multi Node Instance), use tp!instanceindex.

    Eg, If the MNI is running on a variable called Request ID and we want to pass the each request based on the number of iteration then the expression would be as below,

    index(pv!requestId,tp!instanceindex,"")
  • Hi AdirajuB,

    For repeating nodes in loop, you can use the MNI configuration. If pv!ClaimInfo_cdt has 3 set values, the Email node smart service hits 3 times to send an Email notification. For sending to 3 different emails for every iteration, you have to pass the tp!instanceindex to the cdt.
    EX: pv!ClaimInfo_cdt[tp!instanceindex].customerEmailID.
    So in this case, it will work, as you expected.
    I'm not sure about how to customize the body of an email node, I suggest you to write a rule, that maintains the separate body for that particular user. but it is little bit more complex to write the body for all users. If possible go through this link.
    docs.appian.com/.../Configuring_Custom_Email_Senders.html
  • 0
    Certified Lead Developer

    Hi  yes I agree, you can use tp!instanceindex but I am having a quick question.

    Will this email body content be same for all users, if so then try sending this email to group of emails instead of MNI because performance wise MNI is not recommended to use unless that's your last choice. But yes if the body contents are different for all users then probably you can go for MNI.

    But assume you have 1000 of users, and you want to send an email to each one of them,  hence try to process it in batch so that it should not impact the server performance.

  • Hi Ravalik,
    I have tried using the way you have suggested, but I am getting the below error in the activity:

    Details:
    ERROR: An error occurred while evaluation expression: pv_CustomerName:pv!ClaimInfo_cdt[tp!instanceindex].customerEmailID (invalid index: cannot index property 'customerEmailID' of type Text into type Data Store Entity) (Data Outputs)

    I am not really sure what is happening here as I am simply using the email id and in the body using the customer name to test.

    Thanks,
    Adi
  • Hi Alok,
    This will be different for each user as the Claim info is different for each user. There will ever only be some 30-100 pending claims that are older than 90 days and are active. So your suggestion on performance do not apply for my specific case even though I will keep this mind in designing future MNIs.

    Thanks,
    Adi
  • Hi Malathik,
    When I try using this I am still getting the error I have mentioned below. But when I use a variant of this like, index(pv!ResultSet, "customerEmailID",{}), I am getting empty value. Can you please suggest?

    Thanks,
    Adi
  • Hi all,
    I have fixed the error. I was declaring the Process Variable as A data subset model of type ClaimInfo_cdt which was giving the casting error. Once I have changed the PV to a ClaimInfo_cdt datatype, I was able to cast it properly with the instanceindex property. Thank you all for your suggestions!