I'm trying to figure out how to display a button to load a current user's turf. Ideally I would just call a script as soon as the user logs in, but there doesn't seem to be a way to attach bot / task / script sequence to a user login. It can only be triggered on a data change. So I thought I would just create a timestamp field on the user record, display a landing page on login with a welcome message and a 'Next' button, and when the user clicks Next it would update the timestamp field on the user record (which would trigger the automation that calls the script which makes an API call to Salesforce to load the logged-in user's turf to a google sheet), and then navigate to the turf list view.
I'm using this convoluted route rather than just connecting directly to Salesforce because our Salesforce Contact object has more than 650 columns, and hundreds of thousands of records, so even using a security filter to limit the number of records imported doesn't work because I only want about 10 fields. So I wrote an AppsScript to query the Salesforce API with the logged-in user's worksite and return only the 10 fields I need for the 20-30 contact rows in that same worksite. That's all working fine.
The part I can't figure out is how to trigger the API call. I have a 'Current User' slice on my Users table that selects only the row for the logged-in user. I added a fields for a welcome message and instructions to 'Click Next to view your turf list' and then tried to build a Card View on that Current User Slice. The Card view displays the welcome message and instructions, and then I tried to add an Action button that would update the timestamp field (which would trigger the automation to call the script). But it turns out that action isn't available to the Card View because the action type "Data: Set the value of some columns in this row" isn't available in Card View. I'm not sure I understand why, since the card is displaying data for a single row, but the support agent I chatted with said the Action does not have the correct scope to display on the card. I tried with detail view as well but had the same issue. I have confirmed that the action is available to the slice and has no conditional display rules blocking it from displaying -- the support person told me the problem is the scope of the action.
Does anybody have any other ideas how I could accomplish this? I'm not wedded to the landing page => Action button => Update Timestamp => Trigger Automation => Call Script process; it feels ridiculously convoluted and if there's a simpler way to do it I'd love to hear any ideas. All I want to accomplish is to load the current user's data into a list view when they log in, but I'm limited by the enormous size of the source data in Salesforce so I can't connect with it directly and have to write an API call to get just the data I need for that session.
User | Count |
---|---|
35 | |
11 | |
3 | |
3 | |
2 |