• Katerina Parkins
  • NEWBIE
  • 20 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 7
    Replies
Hello, I have a custom object with STATUS field which I'd like to auto-populate based on whether the object's child object(s) RECEIVED date field is populated. (or the child's STATUS field if the date field would cause issues) These two objects have a master-detail relationship. There is never a set number of the child objects and can vary from 0 to 15 and they all have their separate RECEIVED dates.

I would like the master object's STATUS to be auto-updated based on the 'lowest' number of the individual entries in the child object i.e. if 2 entries are marked but one isn't then the STATUS field would say 'Partially' until they are all populated, then the STATUS would change as ALL IN.

Can this be done using roll-up summary and field update workflow or would this have to be done by a code? I can't figure out how to create a formula which would check the fields for entries and then update the master status field accordingly. 

Thanks so much for your help.

Katerina 

 
Hello, I have created a validation rule which stop users linking one company's contacts to another company's account licence. However one record type 'IPAD Contact Licence' is excluded from this rule, all works fine and the formula currently looks like this:

AND( 
Contact__r.AccountId <> Company_Licence__r.Company__r.Id,
RecordType.Name <> "IPAD Contact Licence" 
)

Now I have a challenge to include this record type in this restriction but not fully - the Contact Account ID doesn't have to be equal to the Company Licence Company ID, but needs to be within the company hierarchy so our users can attach a contact to a licence sitting under a different branch.

I'm not sure how to amend the formula to ensure all the other record types follow the existing validation rule and add the exception above.

Hopefully this makes sense. 

Thanks.

Katerina
I have created a junction object 'SR Contacts' which has a M-D relationship with Contacts and a custom object 'SR'. I have created a 'send email' button to send an email to multiple contacts. The pop up window to select a template works but when I hit the SEND button nothing happens. (this is in Sandbox)
I'm not quite sure whether I'm using the correct contact API field - do I use the one on the junction object or the standard contact field? I just don't know whether the Contact_Name__c is the correct API but I took it from the custom object lookup fields to Contacts? I'm not even sure whether that's the problem! Anyway here is the code - thank you. Katerina 

{!REQUIRESCRIPT('//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js')} 
{!REQUIRESCRIPT('//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js')} 
{!REQUIRESCRIPT("/soap/ajax/19.0/connection.js")} 

function appendTags(){ 
if(jQuery('[id=start-theme-css]').length==0){ 
jQuery('head').append( 
'<link ' + 
'id="start-theme-css"' + 
'rel="stylesheet"' + 
'href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/start/jquery-ui.min.css"' + 
'type="text/css" />' 
); 

jQuery('body').append( 
'<div id="dialog-confirm" title="Quick Mass Mailer">' + 
'<p style="text-align:justify">' + 
'<img src="/s.gif" alt="Contact" class="pageTitleIcon" title="Contact" style="margin: 0 7px 30px 0"/>' + 
'Please select an email template to use. To create a new template, you must exit this mass email process and create the new template in your personal setup section.' + 
'<br/><br/>Email Template:<br/>' + 
'<select id="email-template" style="width:380px"></select>' + 
'</p>' + 
'</div>' 
); 



function createPopupWindow(){ 
jQuery(function() { 
jQuery( "#dialog-confirm" ).dialog({ 
resizable: false, 
width: 400, 
modal: true, 
show: { 
effect: "bounce", 
duration: 500 
}, 
hide: { 
effect: "bounce", 
duration: 500 
}, 
buttons: { 
"Send Mail": 
function() { 
sendMail(); 
}, 

Cancel: 
function() { 
jQuery( this ).dialog( "close" ); 


}); 
}); 


function fetchEmailTemplates(){ 
var emailTemplates = 
sforce.connection.query( 
'SELECT Id, Name FROM EmailTemplate', 

onSuccess: 
function(result){ 
var records = result.getArray('records'); 
var innerHtml = '<option value="">--Select--</option>'; 
for(var i=0; i<records.length; i++) 
innerHtml += 
'<option value="' + records[i].Id + '">' + 
records[i].Name + 
'</option>'; 

jQuery('[id=email-template]').html(innerHtml); 
}, 
onFailure: 
function(error){ 
alert('An Error has Occurred. Error: ' + error); 


); 


function sendMail(){ 
var urecordIds = {!GETRECORDIDS( $ObjectType.Sales_Resource_Contacts__c)}; 
var contactIds = []; 
var queryResult = sforce.connection.query('Select Name,Id, Contact__c from Sales_Resource_Contacts__c where Id in (\'' + urecordIds.join('\',\'') + '\')' ); 
var records = queryResult.getArray("records"); 

for (var a=0; a<records.length; a++) { 
contactIds.push(records[a].Contact_Name__c);


var templateId = jQuery('[id=email-template]').val(); 
if(contactIds.length>0 && templateId!=''){ 
var massMailRequest = new sforce.MassEmailMessage(); 
massMailRequest.targetObjectIds = contactIds; 
massMailRequest.templateId = templateId; 
massMailRequest.replyTo = 'noreply@salesforce.com'; 

sforce.connection.sendEmail([massMailRequest]); 

alert('Your emails have been submitted for processing.'); 



appendTags(); 
fetchEmailTemplates(); 
createPopupWindow();
 
Hello, I have a custom object with STATUS field which I'd like to auto-populate based on whether the object's child object(s) RECEIVED date field is populated. (or the child's STATUS field if the date field would cause issues) These two objects have a master-detail relationship. There is never a set number of the child objects and can vary from 0 to 15 and they all have their separate RECEIVED dates.

I would like the master object's STATUS to be auto-updated based on the 'lowest' number of the individual entries in the child object i.e. if 2 entries are marked but one isn't then the STATUS field would say 'Partially' until they are all populated, then the STATUS would change as ALL IN.

Can this be done using roll-up summary and field update workflow or would this have to be done by a code? I can't figure out how to create a formula which would check the fields for entries and then update the master status field accordingly. 

Thanks so much for your help.

Katerina 

 
Hello, I have created a validation rule which stop users linking one company's contacts to another company's account licence. However one record type 'IPAD Contact Licence' is excluded from this rule, all works fine and the formula currently looks like this:

AND( 
Contact__r.AccountId <> Company_Licence__r.Company__r.Id,
RecordType.Name <> "IPAD Contact Licence" 
)

Now I have a challenge to include this record type in this restriction but not fully - the Contact Account ID doesn't have to be equal to the Company Licence Company ID, but needs to be within the company hierarchy so our users can attach a contact to a licence sitting under a different branch.

I'm not sure how to amend the formula to ensure all the other record types follow the existing validation rule and add the exception above.

Hopefully this makes sense. 

Thanks.

Katerina
I have created a junction object 'SR Contacts' which has a M-D relationship with Contacts and a custom object 'SR'. I have created a 'send email' button to send an email to multiple contacts. The pop up window to select a template works but when I hit the SEND button nothing happens. (this is in Sandbox)
I'm not quite sure whether I'm using the correct contact API field - do I use the one on the junction object or the standard contact field? I just don't know whether the Contact_Name__c is the correct API but I took it from the custom object lookup fields to Contacts? I'm not even sure whether that's the problem! Anyway here is the code - thank you. Katerina 

{!REQUIRESCRIPT('//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js')} 
{!REQUIRESCRIPT('//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js')} 
{!REQUIRESCRIPT("/soap/ajax/19.0/connection.js")} 

function appendTags(){ 
if(jQuery('[id=start-theme-css]').length==0){ 
jQuery('head').append( 
'<link ' + 
'id="start-theme-css"' + 
'rel="stylesheet"' + 
'href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/start/jquery-ui.min.css"' + 
'type="text/css" />' 
); 

jQuery('body').append( 
'<div id="dialog-confirm" title="Quick Mass Mailer">' + 
'<p style="text-align:justify">' + 
'<img src="/s.gif" alt="Contact" class="pageTitleIcon" title="Contact" style="margin: 0 7px 30px 0"/>' + 
'Please select an email template to use. To create a new template, you must exit this mass email process and create the new template in your personal setup section.' + 
'<br/><br/>Email Template:<br/>' + 
'<select id="email-template" style="width:380px"></select>' + 
'</p>' + 
'</div>' 
); 



function createPopupWindow(){ 
jQuery(function() { 
jQuery( "#dialog-confirm" ).dialog({ 
resizable: false, 
width: 400, 
modal: true, 
show: { 
effect: "bounce", 
duration: 500 
}, 
hide: { 
effect: "bounce", 
duration: 500 
}, 
buttons: { 
"Send Mail": 
function() { 
sendMail(); 
}, 

Cancel: 
function() { 
jQuery( this ).dialog( "close" ); 


}); 
}); 


function fetchEmailTemplates(){ 
var emailTemplates = 
sforce.connection.query( 
'SELECT Id, Name FROM EmailTemplate', 

onSuccess: 
function(result){ 
var records = result.getArray('records'); 
var innerHtml = '<option value="">--Select--</option>'; 
for(var i=0; i<records.length; i++) 
innerHtml += 
'<option value="' + records[i].Id + '">' + 
records[i].Name + 
'</option>'; 

jQuery('[id=email-template]').html(innerHtml); 
}, 
onFailure: 
function(error){ 
alert('An Error has Occurred. Error: ' + error); 


); 


function sendMail(){ 
var urecordIds = {!GETRECORDIDS( $ObjectType.Sales_Resource_Contacts__c)}; 
var contactIds = []; 
var queryResult = sforce.connection.query('Select Name,Id, Contact__c from Sales_Resource_Contacts__c where Id in (\'' + urecordIds.join('\',\'') + '\')' ); 
var records = queryResult.getArray("records"); 

for (var a=0; a<records.length; a++) { 
contactIds.push(records[a].Contact_Name__c);


var templateId = jQuery('[id=email-template]').val(); 
if(contactIds.length>0 && templateId!=''){ 
var massMailRequest = new sforce.MassEmailMessage(); 
massMailRequest.targetObjectIds = contactIds; 
massMailRequest.templateId = templateId; 
massMailRequest.replyTo = 'noreply@salesforce.com'; 

sforce.connection.sendEmail([massMailRequest]); 

alert('Your emails have been submitted for processing.'); 



appendTags(); 
fetchEmailTemplates(); 
createPopupWindow();