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.
@SEIU_503 wrote:
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.
You most certainly CAN have a button of this type of action. If it wasn't showing it is likely because some setting was incorrect somewhere.
Below are two images showing the Time after tapping the "Update Val 1" button
There shouldn't be anything stopping you from triggering the Bot from tapping a button in a Card View.
On your datasource...
The best thing for your app going forward is to unravel the Salesforce data. There is absolutely no reason to have 650+ columns in a single table to be used for "live" updates. It must be excruciatingly slow even in Salesforce!
That said, it is my understanding that Salesforce DOES provide ways to create a subset of data similar to "views" in a database. Something called List Views. I would investigate creating one of those and using that as the table source into AppSheet.
Until then using a script or service to extract the data the app needs is the best route. I assume you are inserting the data into an interim table? You may find that the automation encounters run time limits and times out depending on amount of data you are trying to extract. If that is the case, then you would need to create a process that is completely off the AppSheet platform and inserts directly into the interim table. Scripts can triggered on a schedule. Make or Zapier are integrator services that may prove useful as well.
I hope this helps!
@WillowMobileSys Thanks for your response. Regarding the data source, completely agree that the Salesforce data structure is ridiculous, unfortunately I’m not the admin of the SF instance and have no control over that part. I just have to figure out how to get the parts I need into AppSheet. And the AppSheet integration with SF does not allow connection to List Views, Reports, or anything other than a full sObject, including all fields and all rows, according to the support people I’ve talked to (although I’d love to hear more if you know a way to work around that). It’s possible to limit the number of rows rendered in the app with security filters, but not the number of columns.
So given that I’m stuck with a massive unwieldy table in my source data, the best way I could figure out how to manage it is to only pull in the data I need with an API call in an AppsScript. I am glad to hear that it’s possible to place this type of action button on a card view, and would love some help figuring out what I’m doing wrong. The support person I was chatting with yesterday accessed my app and was not able to figure it out, and told me it was not possible to do because the action did not have the correct scope for the view, and could not identify which record it should be acting on. This sounded wrong to me because the detail view is by definition a view of a single record, so I don’t see how that could be the problem, but he told me it wasn't possible.
Here are some screenshots of my setup, if you have any ideas what I’m doing wrong I would love some suggestions.
Underlying data source is the Users table, which is connected to a Google sheet:
The view is built on a slice of that table called Current User:
I have added the Load Turf Users action to that slice. (When things weren't working, I experimented with creating a grouped action called 'Next', which would include the Load Turf Users action in the group, but this didn't make any difference)
The Load Turf Users action is set to update the Load Turf Timestamp column in the Users Table:
I have tried all 3 possible Position values for this action -- Primary, Prominent, and Inline attached to various columns, none of them made any difference.
The view I'm trying to enable the action on is Landing Page:
It's currently set up as a Detail View with Card Layout toggled on, I originally tried it as a Card View type; either one would work if it would display the action button. The View is attached to the Current_User slice of the Users table.
On the card layout, I have tried with each of the 4 action slots (2 text; 2 icon) to attach either the 'Next' or 'Load User Turf' actions:
before I attach an action (when the dropdown at right just says 'On Click'), the button or icon is visible in the mobile app preview at right. As soon as I attach one of these two actions to any of the 4 action slots, that action disappears from the mobile preview. If I attach a different action from the dropdown (such as 'Compose Email'), then the button reappears in the preview. Which makes me think there is something about the way the action is configured that makes it inaccessible or disallowed in this layout?
If you have any ideas about what I'm doing wrong or would be willing to share screenshots of the equivalent config that enabled you to set up the action button on your card layout that would be very helpful, thank you!
Your button action is defined as an "Inline". It technically should not be "Inline", however my testing seems to show it doesn't matter. I wonder if it does for you?
Do you have anything configured in the Behavior section of the action?
Is the column "Load Turf Timestamp" an editable column?
Yes, Load Turf Timestamp is editable. Nothing at all configured in the Behavior section on the Load Turf Users action. And I have tried Inline, Prominent, and Primary for the action Position -- no difference regardless which one I use. Any other possible configuration errors you can think of? I have also tried just logging out, deleting the action and making a new one, etc., in case it's some kind of weird caching glitch or something. But no luck
User | Count |
---|---|
34 | |
11 | |
3 | |
3 | |
2 |