brahtim Posted October 28, 2019 Posted October 28, 2019 Sample Code: trigger AccountTrigger on Account ( after insert ) { Set < String > setBillCountries = new Set < String >(); for( Account acc : trigger.new ) { if ( acc.BillingCountry != null ) setBillCountries.add( acc.BillingCountry ); } if ( setBillCountries.size() > 0 ) { Map < String, String > mapTopicNameId = new Map < String, String >(); for ( Topic objTopic : [ SELECT Id, Name FROM Topic WHERE Name IN: setBillCountries ] ) mapTopicNameId.put( objTopic.Name, objTopic.Id ); for( Account acc : trigger.new ) { if ( acc.BillingCountry != null && mapTopicNameId.containsKey( acc.BillingCountry ) ) { ConnectAPI.Topic objTopic = ConnectAPI.Topics.assignTopic( null, String.valueOf( acc.Id ), mapTopicNameId.get( acc.BillingCountry ) ); } } } } Note: Each assignTopic() counts against DML limit. Use assignTopicByName() to avoid SOQL and use Topic Name instead of Id. https://expertwebcode.blogspot.com/2019/10/how-to-auto-assign-topics-to-records-in.html
Moderators JLogan3o13 Posted October 28, 2019 Moderators Posted October 28, 2019 (edited) And this has exactly what to do with AutoIt? ***In case you were wondering, this is a Mod stepping into a thread*** Edited October 28, 2019 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now