Forum Discussion

811locate's avatar
811locate
Qrew Member
2 months ago

Auto change record to 'Expired' when copied.

New learner here. I'm trying to copy a ticket record and open new copy in edit mode. After I copy, I need the original record I copied from to automatically mark the <Status Field> (which is a text-multiple choice field) to "Expired" and the new ticket record <Status Field> to "Current".  I'm not sure the best way to do this, or if there may be a more efficient way not using the <Status Field>.

  • Here is one possible solution

    Create a button that will execute the API_GenAddForm

    Here is a very simple example of building the URL to do that

    var text URLGenAdd =

      URLRoot() & "db/" & Dbid() &   "?a=API_GenAddRecordForm&_fid_8=" & URLEncode ([Record ID#])& "&dfid=10";

    This says to Open Form 10 and fill field ID 8 with the Record ID# of where you started with.   

    You would keep adding to this for the fields in the new record you want to copy the values from the original record.

    Then you would create a Pipeline that fires when a record is saved and Field ID 8 is filled in.   That Pipeline goes to your original record and changes the status.

     

  • DonLarson's avatar
    DonLarson
    Qrew Commander

    Here is one possible solution

    Create a button that will execute the API_GenAddForm

    Here is a very simple example of building the URL to do that

    var text URLGenAdd =

      URLRoot() & "db/" & Dbid() &   "?a=API_GenAddRecordForm&_fid_8=" & URLEncode ([Record ID#])& "&dfid=10";

    This says to Open Form 10 and fill field ID 8 with the Record ID# of where you started with.   

    You would keep adding to this for the fields in the new record you want to copy the values from the original record.

    Then you would create a Pipeline that fires when a record is saved and Field ID 8 is filled in.   That Pipeline goes to your original record and changes the status.

     

    • 811locate's avatar
      811locate
      Qrew Member

      Thank you for responding.  When you say keep adding to this, do I need to copy the entire formula you posted, paste underneath and change the information for the next field??  That is what made sense to me, but, when I do that I am receiving an error message "There are extra characters beyond the end of the formula".  Not sure what I am doing wrong.

      • DonLarson's avatar
        DonLarson
        Qrew Commander

        Also I am assuming that you are using a Formula Rich Text field.   Here is a screen shot showing how to tell

         

        In this case I have a field in my Run Rate table called Create Contract and it is FID 8.

        I know your answer looks very complicated but this will let you build logic to move your Users all over the application.

    • 811locate's avatar
      811locate
      Qrew Member

      This works perfectly except for the Look Up Fields.  I have 4 fields that are look up values and these will not copy.  Is there a different formula I should be using for the look up fields?

      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend

        You should look at the relationship where they look up fields come in. At the top right of that relationship is the reference field for the relationship, it might be called something like Related Parent.

         

        if you copy that field, then all the look up fields will update

    • 811locate's avatar
      811locate
      Qrew Member

      I am trying to create my pipeline but I do not see an option for "when record is saved".  I tried to create one for when a record was added but it is changing my newly created record and not the original one.