The Freshworks CRM Node offers nice UI support. For the “Contact” → “Create” action it offers an additional field called “sales_accounts” which is implemented as a multiOption field with an attached loadOptionsMethod.
I do have the ID of one sales_account that I want the contact to create within from a previous node. But the n8n editor always fails the validation of the field input. I tried an array of string, an array of int, an object, an array of objects …
Thanks Jan!
I believe I simply missed the {{ }} and such always used strings when I believed to use structured data … ouch … I will be able to confirm this at the start of next week.
@jan
I was finally able to retest this and your suggestion is not working:
When I select any one of the prepopulated values and then add an expression, the value is simply converted into a simple string. The Expression contains this: <valid-id>.
Where <valid-id> is the ID string of the selected entity.
As you suggested, I changed the expression to this: {{ ["<valid-id>"] }} => [Array: ["<valid-id>"]]
and also tried this: {{ [<valid-id>] }} => [Array: [<valid-id>]]
Both lead to the same validation error in the UI:
The value “[Array: [<valid-id>]]” is not supported!
Hi @JanTh, dealing with the same need here (with a Mattermost node, to add a specific member, having the username as input), did you manage to find a solution?
@_jd So it seems to be a more general problem after all
But no, sadly as you can see, I never got a reply to my last message from @jan and that’s when we stopped searching for any other creative solution :-/
The UI validation shouldn’t matter so much when putting in an expression, what happens when the value is sent do you get another error back or does it work?
Looking at the Mattermost API docs it looks like adding a user will use the ID not the Username so while we display the user name behind it we actually use the ID. To work around this you can add in an HTTP request node first to call /api/v4/users/usernames and send the username there and it will return the ID that you can then use in an expression to the Channel Add operation.
This would look something like the example below, You may find that you need to use the Channel ID as well rather than the name so you may need to also use Mattermost API Reference
It would be a lot easier if it was in the node, I was thinking earlier that we could probably make the call to the user search endpoint internally to get the ID and do it in the background. It is still going to be the same amount of calls just handled differently. Another option might be to just add the user search by name to the node as well.