0

We are using a 3rd party app to have incoming emails send to SF under our custom Messages Object. However, the app also changes the ownership of the record to the themselves when a user clicks to view the message. We want to implement Queues and be able to leave these emails under the Support Queue,Wholesales Queue, etc. It's tedious to have the user keep changing the ownership back to the Support Queue as the owner.

Is there a way to create a process/flow/trigger that will be able to block this change or change the record owner back to the queue? I believe this may be the code below but I am not entirely sure as this is a list button. However, I cannot find any other place that does this exact change. Please assist!

{!REQUIRESCRIPT("/soap/ajax/15.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/15.0/apex.js")} 

var newRecords = [];

var ids= {!GETRECORDIDS($ObjectType.CloudConversion__Message__c)};

//Confirming users action
var r = confirm('Take ownership of these messages?');
if(r == true) {
if(ids.length < 1 ) {
alert('Please select at least one message.');
} else {
for (var n=0; n<ids.length; n++){
var sv = new sforce.SObject('CloudConversion__Message__c');
sv.CloudConversion__Status__c = 'Working';
sv.OwnerId = '{!User.Id}';
sv.id = ids[n];
newRecords.push(sv);
}
result = sforce.connection.update(newRecords);
}
}
window.location.reload();
  • When the 3rd party app takes ownership, does it assign them to the same user? If so, you can write a simple Apex trigger that would just revert this change. – zaitsman Jun 17 at 23:42
0

Yes, it assigns it automatically to the user that clicks on that record. For example, we have messages that come in. Once a user clicks on that message, the ownership changes to them as a way to "assign" them the message. The flaw is that we have default signatures that are associated with the message that comes in so that it would be Customer Support or Info that would respond. Rather, when the ownership changes, the signature changes to the user.

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.