Discussions

Expand all | Collapse all

Pipeline Question about Null Values/Clear Related Reference Field, but Maintain Key Field Value in a Copy Field

  • 1.  Pipeline Question about Null Values/Clear Related Reference Field, but Maintain Key Field Value in a Copy Field

    Posted 09-16-2021 17:03
    Edited by Daniel Johnson 09-16-2021 17:07
    Hi All,

    I've got a Pipeline that copies the value in the Related Parent Record field into a separate field when that relationship is made (triggers when Related Parent Record field changes, outputs that value into a copy field). In my workflow the user makes that relationship manually from a record picker. The field the Pipeline copies that record ID into is there so that I can add a report link to the parent record and capture the parent record ID in the child table to be used in an API call that would clear the Related Parent Record field. This allows me to add a button to the linked report to "Unrelate" the child record if it was actually a mistake by the user, while also allowing the user to stay on the parent record.

    It's a button and not defaulted to open in grid edit because there's another button in the child record that serves as a media player, which can't be used if opened in grid edit. So, clicking the unrelate button clears the Related Parent Record field, and then grabs the record ID of the parent record from the field the Pipeline copied into when the relationship was first set, so that I can reload to the parent record, which is the only place that "unrelate" button shows up.

    When I click the "unrelate" button, Pipelines registers the trigger but doesn't change the value in the copy field to null. This actually works with Pipelines ONLY because Pipelines is spitting back a notice that says, "Skipped because set values are the same as in source object.

    My question is why? This is the behavior I want, but I wasn't expecting it. I was expecting the API to just run quicker than the pipeline. In other words, I was expecting the API to be able to grab that copy field before Pipelines had a chance to clear it. However, it doesn't look like Pipelines will clear it. Does anyone know why? I have a feeling this could be leveraged if understood.

    Thanks,

    ------------------------------
    Daniel Johnson
    ------------------------------


  • 2.  RE: Pipeline Question about Null Values/Clear Related Reference Field, but Maintain Key Field Value in a Copy Field

    Posted 09-16-2021 17:20
    Response from QB Care:

    "So you cant pass a blank value through Pipelines. When you clear the field on the form it's not defaulting it to 0, it is just blank. Pipelines do not work with blank values so it is not changing the field in Step B because there is nothing coming from Step A.

    So when you clear the value, Pipelines does not convert it to a null value or a zero it is just blank. Actually, if you changed it to a zero that would work as zero is a value."

    The Pipeline is fairly straight forward to setup. Here's what my button looks like:

    URLRoot() & "db/" & [_DBID_ALIAS_CHILD] & "?act=API_EditRecord&apptoken=xxxxxxxxxxxxx123456789&rid=" & [Record ID#]
    & "&_fid_25_="
    & "&rdr=" & URLEncode(URLRoot() & "db/" & [_DBID_ALIAS_PARENT] & "?a=er&rid=" & [Related Parent Copy])

    fid=25 is the Related Parent field on the child record.

    ------------------------------
    Daniel Johnson
    ------------------------------