I am creating case comment using Apex. I am using the following code to add comment:
CaseComment cc=new CaseComment();
cc.ParentId=obj.Id;
cc.CreatedById='12323re';
cc.CommentBody='test comment';
insert cc;
I am getting the following error on compile time :
Field is not writeable: CaseComment.CreatedById
How can i change the Created by of a Case comment?
Case Comment cannot be created by the different user as CreatedById is not a writable field. Salesforce does not allow this for some security reasons.
Temporarily, I have stored the commenter information in the comment body and used the information from the comment body for further use.
Related
All I want to do is,
Add Salesforce as destination
From the Track Object, get a field
Update to Salesforce
I created a custom action
But it does not work
everytime it inserts a lead
My action is not executed
What am I doing incorrect?
Below image I am testing to create a case to see if that works.
It throws and error for not including Salesforce:true.
Not sure where to include that
I think the issue is that you are using the Create operation for the action. Instead of creating a new case, you should use an Update operation. As the form says:
If the CRUD Operation is Update an ID field mapping is required.
I can't see that you have included an ID field in your field mappings there either. You will need that ID, so that you can update your customer.
This may be a kind of basic question, but I simply cannot find an answer...
It is tied to ArrangoDB and I'm just learning it, when I try to insert data with POST request (REST API) I get an error if I add another parameter that is not the "_key" parameter, so the picture below adds a document successfully
but when I try to add a parameter it gives me an error
When I add a document inside a web interface it is inserted successfully even if I add more parameters...
Does anyone know how to insert a document with more parameters into collection? Do I need to define a schema maybe? Thanks in advance for the answers.
d
I am trying to make a batch update to Salesforce as part of a data masking project and am getting the error INVALID_FIELD_FOR_INSERT_UPDATE when I try updating fields of a particular custom object via API.
Our custom object has a few standard fields and a few custom fields. The custom fields are what I'm trying to update but I keep getting denied.
Each field that I'm trying to update is either Long Text Area(32768) or Text(255). There are no lookups, controlling fields, validation rules, nor are there field dependencies.
I am able to make modifications to other objects (Account for example) via the masking process. I am also able to make modifications to the values through the web UI on the values for this custom object.
I've tried as members of the API group as well as System Administrator.
Can anyone please point me in the right direction? I don't have access to the source code of the masking tool, but I do have elevated rights in SF.
Thanks in advance for your advice.
The exact error:
INVALID_FIELD_FOR_INSERT_UPDATE Error message: Unable to create/update fields: Name. Please check the security settings of this field and verify that it is read/write for your profile or permission set.
The funny thing is that I'm not trying to update the field "Name". Name seems to be an auto-number field on the object, but I'm not sure why this field would change value on an update to a different column.
If some one facing the same issue of not able to update the Name column because it has data type as Name.
There are 2 solutions:
If you want to push the name of human then try pushing FirstName and LastName instead. "Name" will get populated automatically.
If you want to push the name of a product then try changing the type of Name field to Text. If that doesn't work then you can push the name to either FirstName or LastName, whichever is mandatory(Just A work around).
I have a Profile Type attached to a user. In there I have a Entity Reference Field of Program Manager. I have Live Events(content-type) that people can register for. I set up a Rule to Email the Program Manager every time someone registers.
My problem is I am trying to pull information from the Profile based on the the entity reference for the Program Manager.
I have the field printing out by using this pattern...
[registration:entity:field_program_manager]
However when I try to pull the first name, email of phone I can not get it to show up.
Does anyone have any ideas to share?
Many Thanks!
Okay so I was trying to solve for sending the email to the Author of the page but was having issues. So I created a new fields hoping it would be easier. In trying to solve for this I solved the original issue.
To print the Author of a node to an email through Rules actions us this.
[registration:entity:author]
So for first name it would be:
[registration:entity:author:profile-main:field_first_name]
Hope it helps someone else.
If you're using entityform instead of a node and referencing the default user info (not the 'Main Profile' profile type), then you want to use something like
[entityform:field-staff-entity-ref:field-work-email]
In this case, 'field-staff-entity-ref' is the entity reference field in the entityform and 'field-work-email' is the field in the user's account settings.
I'm writing triggers / classes to post field change notifications to the Chatter feeds of objects related to the object undergoing change (e.g. posting a field update of an Opportunity to its related Account is changed).
I've written the code to compare the before and after values and post feed updates for the values that have changed just fine. But I only want to post updates for fields that are set to be "tracked" in Chatter (Setup -> Customize -> Chatter -> Feed Tracking).
How can I get at these settings in Apex?
(It's possible to call isFeedEnabled() on an object to see if Chatter is enabled for that object. But I don't see any way to tell if an individual field is set to have its updates posted to the feed)
Cheers,
Ray
There's call like isFeedEnabled() for checking on field-level tracking (both for chatter and the old style field history) sadly.
You could however use a trigger on the feedItem sObject to see if an item where Type == 'FeedTrackedChange' is created, and if so query the FeedTrackedChanges related to that FeedItem; then create the chatter post from there.