Trigger custom action: update URL when TEXT changes

We’ve got a LINK type column in our board. The user is supposed to enter the TEXT, and we should find the URL based on the text. The text in this case is a Quote ID, the URL should link to our CRM system.

In the below example, the user enters “QUO07313”, and the URL should be updated accordingly. I’ve triggered from the “Update Any Column” event and then invoke a custom action. In that action, I cannot update the item (I’ve found many articles in the community about this, suggesting to use variables instead of a string - I’ve tried that as well). I don’t get an error back, but the response is the unmodified item data.

Could this be because this could cause a cascading trigger? (And is therefore prevented by Monday.com?) How could we still realise this? (Other then needing the user to enter the url himself…)

The GraphiQL query is: (it works fine when using GraphiQL Online with Headers | Built by Hasura)

mutation {
change_column_value (board_id: 11111111, item_id: 22222222, column_id: “link”, value: "{“url”:"https://url.web.com/index.php?module=Quotes&view=Detail&record=662840",“text”:“QUO07313”}") {
id
}
}

Hey @Jaap-CAD2M :wave:

That’s a great question! Since the query works in the online environment you’ve mentioned, I’m wondering if this might be related to the way you are sending the values?

Based on the query you’ve provided, I’m wondering if:

  • There might be an issue with the IDs you are using. I would recommend checking the Item, Board and column IDs;
  • There is an issue with the formatting of the request. When sending a mutation to our GraphQL API, it must be formatted as a JSON string, and the column values will need to be escaped further in the JSON;
  • You will also need to specify that you are sending a query to the API, and then declare it is a mutation;
  • Please make sure you are using " as the quote symbol;

Here’s a Postman request that updates a Link column value

Here is the query itself:

{"query" : "mutation { change_column_value (board_id: 589795234, item_id: 589795238, column_id: \"link\", value: \"{\\\"url\\\":\\\"https://url.web.com/index.php?module=Quotes&view=Detail&record=662840\\\",\\\"text\\\":\\\"QUO07313\\\"} \") {id }}"}

Here is a cURL code example too:

curl --location --request POST 'https://api.monday.com/v2' \
--header 'Authorization: YourApiKey' \
--header 'Content-Type: application/json' \
--data-raw '{"query" : "mutation { change_column_value (board_id: 589795234, item_id: 589795238, column_id: \"link\", value: \"{\\\"url\\\":\\\"https://url.web.com/index.php?module=Quotes&view=Detail&record=662840\\\",\\\"text\\\":\\\"QUO07313\\\"} \") {id }}"}'

-Alex

It’s working. I was staring blind on the possibility of a cascading update, but the problem was much simpler: I had a wrong variable that I passed to the monday client :frowning:

Final working code:

          const mutation = `mutation changeValue ($board_id: Int!, $item_id: Int!, $column_id: String!, $value: JSON!) {
              change_column_value (board_id: $board_id, item_id: $item_id, column_id: $column_id, value: $value) {
                id 
              }
            }`;
          

          const variables = { board_id: parseInt (itemDetails.board.id), item_id: parseInt(itemDetails.id), column_id: COL_QUOTE, value: JSON.stringify (linkValue) };

          const response = await mondayClient.api(mutation, { variables });

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.