REMINDER
SOLVED Cloud Backend trigger formula parameter
-
Hi there,
there is a parameter type in the backend trigger called "formula (javascript)".
There is NO documentation about it. How frustrating.So because the software vendor was not able to document their functionalities properly, I need your help to resolve this:
One parameter is called "ID" and this ID is actually the id of the parent element of the current element (where I add this trigger).
I tries to enter "this.parentElement.id" but I get the error: "Cannot read properties of undefined (reading 'id')"
Can someone help please?
Thank you
Constance -
Hey @constance-hua,
In that field you can pass ANY valid Javascript instructionhere is an example to fetch the value of an input name EMAIL:
$("input[name='EMAIL']").val() -
@joseph-benguira said in Cloud Backend trigger formula parameter:
$("input[name='EMAIL']").val()
Thanks a lot Joseph for the example, so not javascript but jQuery actually, I see.
I tried with jQuery to get the parent element ID but it also did not work:
$(this).parent().attr('id')Did you try on your side? Here is how to reproduce:
- Create a button section, give it an ID (edit element -> identification)
- Add a button in this section and create a cloud backend action
- Before the function call, check the box "execute a javascript" and add a code to trigger a confirmation pop up for e.g. Put the parent ID in that pop up:
//I tried this: var id = this.parentElement.id //and this: var id = $(this).parent().attr('id') confirm(id)
Let me know if you succeed and how!
Thanks!
Constance -
@constance-hua your logic seems too complex ... Instead please try this
- hide your original button
- create a new button that open your confirmation modal
- if accepted, generate a click to the real hidden button. Eg: $("#myHiddenButton").trigger('click')
done