I wanted to share a success with you.
Our users have different status markers while editing content. We wanted unique buttons to trigger MS Flows in the background, sending an email to a specific recipient, based on a certain status.
To accomplish this, the JavaScript sets a DropDown choice to match the button clicked. The MS Flow watches for that field value to change and commits a conditional task accordingly. Works very nicely.
Here is the code that is entered in the Settings, OnClick for each button (not in the main JavaScript Editor).
fd.spBeforeSave(function() {
fd.field('requestreview').value = 'Requesting A Review';
});
fd.save();
fd.spBeforeSave(function() {
fd.field('requestreview').value = 'Ask A Question';
});
fd.save();
fd.spBeforeSave(function() {
fd.field('requestreview').value = 'Back Later';
});
fd.save();