Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trigger InsertTopic on Account (after insert) {
- List<TopicAssignment> taList = new List<TopicAssignment>();
- List<TopicAssignment> taList1 = new List<TopicAssignment>();
- List<Topic> topicList= new List<Topic>();
- for(Account c : trigger.new)
- {
- String d1= c.Topics__c; // Custom field on Account Object.
- system.debug('aaaaaaaaaa'+d1);
- String[] d= d1.split('\s*,\s*');
- for(String s: d)
- {
- Topic ta1 = new Topic();
- ta1.Name=s;
- topicList.add(ta1);
- }
- system.debug('aaaaaaaaaa'+topicList);
- insert topicList;
- for(Topic s1: topicList)
- {
- TopicAssignment ta = new TopicAssignment();
- ta.TopicId=s1.Id;
- taList.add(ta);
- ta.EntityId = c.Id;
- }
- insert taList;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement