Forum Discussion

JamesCarr's avatar
JamesCarr
Qrew Trainee
2 years ago

Pipeline Incorrect Template Error

I have seen post about this error but I have yet to find anything to help me figure out how to resolve the error with my pipeline.  

Validation error: Incorrect template "{{c.related_member}}". ValueError: invalid literal for int() with base 10: 'related_member'

This related member field is a text field that holds email addresses when populated.  The field I am looking to update records with is also a text field and holds email addresses. I don't know what to do to resolve this.  Any input would be greatly appreciated.



------------------------------
James Carr
------------------------------
  • To give a clearer picture on what I was attempting to do, I wanted to trigger a pipeline when a record from table A is updated, search for records in table B that are related, then search for records in table C that have a matching email address from the table B search OR have a specific checkbox in table C checked. 

    The error in question was due to me trying to use related member from a Search records action without a Loop. For the solution, my pipeline is setup as follows:

    Record updated > prepare bulk record set > search records (table B) > Do loop > search records (table C) with matching email address from B and designated checkbox not checked > update record > end loop > end loop > commit upsert > prepare bulk record set > search records (table C) with checkbox checked > loop > update records > end loop > commit upsert

    I know that each search result from table B will only return one match from table C (if any) and it's a matter of whether or not that result will have the checkbox in question checked or not. I went with not checked for the sake of this nested loop, so I can do a separate search for those that are checked and update them accordingly. Updating table C, in this case, triggers a notification and I did not want to notify people multiple times off one pipeline run. 

    So, focusing on the error, you have to use the search results inside a Loop or you will get this type of error. Thanks, again, Doug, for reminding me of that, which allowed me to come up with this solution for my pipeline. Let me know if there are questions, and I will do my best to answer. 



    ------------------------------
    James Carr
    ------------------------------
  • With a Quickly read, seems the destiny field is numeric.... ??



    ------------------------------
    Marcelo Benavides
    ------------------------------
    • JamesCarr's avatar
      JamesCarr
      Qrew Trainee

      That's the confusing part. It's not numeric. 



      ------------------------------
      James Carr
      ------------------------------
  • I have submitted a customer support ticket and will advise if and when a solution has been developed. Meanwhile, I would still appreciate if someone in this forum has any ideas.



    ------------------------------
    James Carr
    ------------------------------
  • It seems that the value "{{c.related_member}}" is expected to be an integer, but it contains the string "related_member" instead.

    You may need to check the configuration or data mappings to ensure that the correct field is being used. It's possible that there is a mistake in the configuration that is causing the incorrect value to be passed to the template.

    Additionally, make sure that any variables or placeholders in the template are correctly defined and populated with the appropriate values before passing them to the template.



    ------------------------------
    Justin White
    ------------------------------
    • JamesCarr's avatar
      JamesCarr
      Qrew Trainee

      Thanks for replying, Justin.

      While researching this error, I saw similar explanations. I was confused as to why that is because I am mapping to a text field. Related Member is a text reference field and I am mapping it to a key field that is also a text field (email addresses specifically). As I type this, I wonder if the pipeline is interpreting an integer value because the field being mapped to as a key field, despite the fact that the key field is a text field. If that is the case, how do I get around it. I tried using the simple query and the advance query approach and both lead to the same exact error. 



      ------------------------------
      James Carr
      ------------------------------
      • JustinWhite's avatar
        JustinWhite
        Qrew Member

        No problem, I wish I could help you solve this.

        You can try using a formula field in the report settings to explicitly convert the text reference field that uses the 'ToText()' function to convert the value to text. Then, you can map this formula field to the key field instead of the direct mapping from the text reference field. Make sure to back up your data or work with a test environment to avoid any unintended consequences.

        Sorry I was not of better help. Please let me know the solution that customer service comes back with so we can help others who may encounter this. 



        ------------------------------
        Justin White
        ------------------------------

  • DougHenning1's avatar
    DougHenning1
    Community Manager

    That error usually happens when you don't use a loop on search step results.  If your step C is a search query, then you need to use a loop to access the results.  If you know you'll only have a single response you can skip the loop and reference the first element directly:  {{ c[0].related_member }}

    Hope that helps!



    ------------------------------
    Doug Henning
    ------------------------------
    • JamesCarr's avatar
      JamesCarr
      Qrew Trainee

      Hi Doug,

      I saw that suggested solution given to someone else. C is from a Search Query. However, I want to use each related member found to search another table. Ultimately, the other table I want to search will have records updated if the email address matches the related member from the first search OR if a certain checkbox is checked. How would I arrange my pipeline steps to do this? Some records that are to be updated may match the email from the first query AND have the checkbox in question checked. The update to the record is going to trigger a notification so I am hoping to avoid multiple notices to the same email. 

      Let me know if I need to provide a better description for what I am trying to do.



      ------------------------------
      James Carr
      ------------------------------
      • JamesCarr's avatar
        JamesCarr
        Qrew Trainee

        I have figured out my solution. I need to take care of some business so, it will be a couple of hours (maybe tomorrow) before I post what I had to do. Meanwhile, thank you, everyone, who chimed in. Especially you, Doug. Had you not chimed in and made me rethink what I need to do with your suggestion, I may not have figured out how my pipeline needed to be setup. 



        ------------------------------
        James Carr
        ------------------------------