How can set the default Email Digest frequency for all members to 'Weekly'. At the moment, it is 'Not Subscribed'.
How can set the default Email Digest frequency for all members to 'Weekly'. At the moment, it is 'Not Subscribed'.
So it sounds like the automation is running as the service account which would account for how the subscription was seemingly created successfully and retrieved successfully, but just not for the user you want. Is your automation defined to run as server account?
If so, you may want to uncheck. But if it needs to run as service user for some other permission reason, you can still impersonate a particular API call with core_v2_widget.ExecuteFile .
My automation needs to run as service user.
you can still impersonate a particular API call with core_v2_widget.ExecuteFile .
How would I do this?
Could I call a manual automation from my automation to create the subscription? This manual automation would have the 'Execute as the service account' unchecked.
I have figured out how to do it using core_v2_widget.ExecuteFile, thanks.
You would call:
$core_v2_widget.ExecuteFile('script.vm', "%{ RunAsUserName = 'mmonteleone' }")
And then in an automation attatchment, script.vm, all API calls execute as mmonteleone. It's also possible to pass parameters via ExecuteFile, but it gets kind of difficult in Velocity. Honestly, I'd recommend writing automations in the default of server-side JavaScript instead.
So you could call:
core_v2_widget.ExecuteFile('script.jsm', { Parameters: { 'a': 1, 'b': 2 }, RunAsUserName: 'mmonteleone' });
And then in script.jsm, access those parameters:
var paramA = core_v2_widget.GetExecutionParameterValue('a'); var paramB = core_v2_widget.GetExecutionParameterValue('b');