Skip to main content

Let me first apologize if my terminology is off- I’m a n00b.


We are syncing the Events object to Outlook through one user we call “CMC Staff”. However, in order to sync all the events have to be assigned to CMC Staff (we are using Riva Sync).


I realize this is an odd thing to do, but its the low-cost option we’ve come to in order to sync our events with Outlook. We’re already paying for more than planned to use Salesforce and now Skuid. We thought there was a way to have all users sync with Riva, using one user, but apparently that’s not the case.


ANYWAY—

*We’re trying to auto-fill the assigned to field, called ‘OwnerId’, of the model ‘All_Events’ (Events object)

WITH the user ‘CMC Staff’ from the model ‘CMCStaff’ (this is the User object with a condition to only show CMC Staff).


By default that field is auto-assigned to whomever enters the event on the Calendar.


—First I tried simply using actions to update the row with “CMC Staff” in the appropriate field, but that doesn’t work. The field shows the text “CMC Staff”, but when it isn’t highlighted it clears. If we try to use the User ID it does the same thing- and telling it to save after putting in the name or ID just returns an error saying it isn’t valid. This I assume is because we are putting in a text value that means nothing to the reference field until it is looked up…


—Then, I found this discussion: https://community.skuid.com/t/question-updating-field-in-one-model-with-a-field-from-a…

**So, I made the model “CMCStaff” using the User model with a condition to load only CMC Staff. That way the only row showing would be CMC Staff (whose info I need). **
Then I tried following this syntax:


I came up with:
{{$Model.All_Events.data.0.Name}}



That didn’t work. So I tried what they defined as their solution later in the discussion:
{{$Model.PrimaryModelName.data.0.ChildObjectName.records.0.FieldName}}


So I came up with:
{{$Model.CMCStaff.data.0.Events.records.0.Name}}


Out of frustration I tried slight variations like substituting the object name with the model name.


A couple of NOTES:

-I’ve tried this as an action when a new row is created, when the model is saved, and when the model is re-queried.

-I’ve tried this a button on the title of the page (for event on-click action in a calendar)

-The Assigned to field references users- so the options for what field to update are all the fields associated to the user or just the OwnerId. I’ve tried them all! (Name, Id, OwnerId, Owner.Id, Owner.Name, I started just making them up.)


-All fields in question are selected in the model.


Let me know your thoughts!!!

Thanks

Ooh! Welcome to the community. We do love our noobs here. No predjudice at all!

I can see that you’ve tried a lot of things. I’m sure you are getting frustrated.


I think the key insight for you is the need to pass a userID value into your Event OwnerID field, rather than a user Name.

This does assume that you have a user in your system called “CMC Staff”. Its also critical that you not be using a Contact ID. It needs to be a User ID.


Having said that - there are several ways you can go about this.


  1. If your Events model is used only to create new event records, you can prepopulate the new event by using a model condition. The condition would be “OwnerID = Field from another model, CMC Staff model, UserID field.”


  1. If you want some user action to effect the change on existing records, add a row action or mass action. The action needs to be "update field on row(s). And the syntax you used above is ALMOST right. Just use the ID field rather than the Name field.


Make sure the Name field is in your CMC Staff model, and Skuid will traverse the ID and populate your Event records with the Name field (looks prettier that way…)


You might add a second action that saves the Event model - or your users will have to push the save button. But maybe you want the “are you sure” moment…


  1. You could probably also run that action when the Event model is loaded - but that’s more of a brute force method and not really reccomended.

Hopefully these options will get you going.


Your use of a Model Action on your All_Events Model is a good approach — set the Initiating Event to “When new row is created in Model”, and then for the Action, do “Update a field on row(s)” as you were doing, with the field being OwnerId (NOT Owner.Id — notice the period in between Owner and Id, this is a subtle difference but a very important one!) , and the Value being {{$Model.CMCStaff.data.0.Id}}


Thanks to both of you for a quick reply!! It’s working :DDD


The key was definitely the condition on the model:


The events model is being used for the calendar- which by default has a setting to make new records. I considered disabling this anhd making a new model just for new creations, but it seems to work fine the way it is.


I had already tried using “Id” before instead of name (I started with Id and then tried anything else), but after setting that condition that was working. Here’s my action:


thanks again! It’s working like a charm.


Reply