SalesforceLabs / survey-force

86 stars 61 forks source link

Not saving record with Two different Custom Object Lookups in Survey Taker #172

Closed Dhruv-Ladani closed 5 months ago

Dhruv-Ladani commented 5 months ago

@jrattanpal / @claico Is there limitation for custom object? Like currently I have added lookup of one custom object in Survey Taker object and done changes in code as mentioned in https://github.com/SalesforceLabs/survey-force/issues/85, now i am adding another custom object lookup and modified code but it's giving error while submitting survey that Invalid Id. FYI, I have removed new custom object lookup from code and only keep previous lookup then it works fine. It gives issue when there is two custom object lookup.

jrattanpal commented 5 months ago

There is no limit. You just have to make sure you account for all fields/ When you add code, you need to assume it'll be empty. If you add it wrong in Apex then it will error out.

Dhruv-Ladani commented 5 months ago

Okay then please tell me if i have modified code correctly or not.

  1. So i have added lookup of Public Event custom object in Survey Object along with one picklist field and made changes to SurveyManagerController and SurveyManagerPage(VF Page). Now I have child object of Public Event which is Event Attendees and this object record's i want to link with Survey Taken, so i have created lookup of Event Attendees object in Survey Taker object and also modified code as you mentioned in #85.
  2. I have lookup of another object also except Event Attendees object in Survey Taker which is of Household__c object. Now in ViewSurveyController i have added both lookups, but it's not working for both of them. When I keep only one lookup in ViewSurveyController from Event Attendees and Household then it works perfectly fine.

FYI Event Attendees is being used as part of Site(Guest User) and Household is used for Internal User. Both have different survey's so i guess that's not problem right?

Can you explain more about empty thing which you suggested.

Dhruv-Ladani commented 5 months ago

Thanks @jrattanpal for your instant support. Now issue is resolved.