function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rao NemaniRao Nemani 

Updating __Tag objects using Apex

Hello Experts

 

COuld you please advise if we can update the tag object using the apex code/trigger/calss ?

 

i am designing a new application hence i need your input here please.

 

thanks in advance.....

Rao

 

hisrinuhisrinu

Yes you can do that.. here is the sample code

 

 

accounttag a = new accounttag();
a.name = 'test';
a.itemid = 'pass the account id';
a.type = 'public';
insert a;

 

 

micraskmicrask

Sorry but that doesn't work. The following code

 

public with sharing class AccountTag {
    public void make(Account a) {
        AccountTag tag = new AccountTag();
        tag.Name = 'You are tagged';
        tag.ItemId = a.Id;
        tag.Type = 'Public';
        insert tag;
    }
}

 

 

returns "Error: Compile Error: Variable does not exist: Name at line 4 column 9" when I try to save it.