2

Getting the Error ....Please help me solve this issue...I have to write in this object.

1
  • Not familiar with the WorkBadge sobject and not finding it in my standard DE org. Can you tell us more about what that object is? Is it related to work.com? It sounds to me that Description on WorkBadge is not writeable via Apex. Perhaps there is some other field available for the information you want to put there?
    – pchittum
    Mar 27 '15 at 12:34
1

I haven't worked with the Work.com badge/thanks objects before, and the object docs are pretty thin, but judging from this data model diagram and the description of the Description field here as "The description of the WorkBadgeDefinition", I think WorkBadge.description is a read-only formula field that pulls its data from the associated WorkBadgeDefinition object. That would explain your error.

I believe that when using the UI, you first define a type of badge which can be used over and over; I believe that corresponds to the WorkBadgeDefinition. You'll probably want to query for this. Looking at all of the fields in the workbadge object docs, sourceId is also required (not nillable); that's the ID of a WorkThanks object, which defines the giver of the badge and a customized thanks message. So you'll need to create a WorkThanks object, then use that to construct one or more WorkBadge objects.

If you want each badge to be from a different user (for example, from the driver's manager), you'll need to first loop over the insert records constructing WorkThanks records, insert them, and then loop over the records constructing WorkBadge objects using the new WorkThanks objects. A map would be a good way to keep track of which WorkThanks objects map to which DriverEfficiency records.

0

Check Description field in WorkBadge is not formula field OR not visible/accessible for the user profile.

If WorkBadge - Description is formula field - see which are all the fields you have used in Formula and enter value in those fields.

Example : if Description = Formula ( field1 + field2)

Do this :

v.field1='test';
v.field2='test2';
1
  • It's a compile error, though. Profile based perms should not cause a compile error.
    – pchittum
    Mar 27 '15 at 12:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.