
Announcements
Hi All,
Have a relatively simple one that seems to be harder than I think it should be:
I've got a canvas app that accepts a "SurveyInstance" parameter, which I expect to match the unique identifier for my SurveyInstance CDS entity:
The general idea here is that I'd like to tie the survey instance to a specific employee and a specific survey. If the survey instance is not provided, I want to take the current user, and through a few lookups, find their existing record. I've run into the limitation on traversing multiple levels of many to one relationships several times in this effort, so I've created some intermediate variables to store values as I go through the lookup process. I'm able to get to the point where I have the GUID returned and stored in varSurveyInstanceID, however, next I'd like to create a variable containing that record so I can avoid having multiple nested lookups throughout the application.
I've tried a few approaches that seemed to work in other areas of the application, but for whatever reason in my OnStart rule I cannot lookup the record by ID:
Set(varSurveyInstance,
Lookup(SurveyInstances, SurveyInstance = varSurveyInstanceID));
Gives an error on comparing a record to a GUID
Set(varSurveyInstance,
Lookup(SurveyInstances, SurveyInstance.SurveyInstance = varSurveyInstanceID));
Gives an error on invalid use of the '.' operator
Set(varSurveyInstance,
Lookup(SurveyInstances, crad7_surveyinstanceid = varSurveyInstanceID));
Gives an error stating it's unable to find the column crad7_surveyinstanceid
Having a bit of a struggle believing looking up a record based on it's ID value is so difficult, is there perhaps something I missed in my table setup or in the syntax here?
Hi @tiddlyplatypus ,
Since I'm not aware of the structure of that Survey Instance table, I would use Accounts the default table as the example:
in Canvas App:
the Account table in Dataverse and the column:
So, I think the first formula in your post is basically correct, except for varSurvey InstanceID variable may be a record. Therefore, you need to have a check in previous variable creation and make sure it is GUID.
Hope this helps.
Best regards,
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.