Scripting - Get Selected Record

We’re using a view to contain company distribution groups. When a user filters into view, I’d like to add the Active Directory user with that email address to a given M365 group. All I need to be able to do is grab the email address off of the selected record within the script > HTTP call. Is it possible to get the selected record (the record that filtered through and caused the automation to happen) so I can provide the email address off of it to my Power Automate flow?

Hi @Deron_Witmer,
I do apologize, I am not 100% sure I follow.

Do you want to get the Record ID of the record that caused an Automation trigger? In your automation actions you will see the record ID from the Trigger record.

In your table, you can get a record ID by adding a formula field with

Record_ID()

Or are you scripting in the Scripting Extension and you need to grab a recordID?

1 Like

Hi Vivid-Squid - that’s exactly right. In my script, I am sending an HTTP call. Within the body of that call, I need to include an email address. That email address is stored on the record that triggered the automation. So, in short, I need to access information from the record that triggered the automation to be available to my script (which is the action on the automation).

I see. You need to set the record_id as an input variable on the left hand side of the automation script editor page.
There you can add the record_id from the trigger event and call it later in your script.

Value(s) also can be retrieved directly

image

for example, i’m using that for kind of inter-base connection, where keeping sync is not a good solution.

let payload={...input.config()}
const options={method:'POST', body: JSON.stringify(payload),
headers:{'Content-Type': 'application/json'}}
const responce=await fetch(addr,options);
const result=(responce.ok)? await responce.json() : responce.statusText;
console.log(result)