• Parvinder Chana
  • NEWBIE
  • 20 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 6
    Replies
Hello all,

I created a custom button on Case object and purpose of the button is to escalate the case. Here is the code and it works great.

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

var caseObj = new sforce.SObject("Case"); 
caseObj.id = '{!Case.Id}'; /* Need Id field to update Case */ 

if ({!Case.IsEscalated} == 0) 

caseObj.IsEscalated= 1; 
}; 


/* Change escalated field */ 

/* update method takes an array of Cases; init to 1 element - 'caseObj' */ 
var result = sforce.connection.update([caseObj]); 

if (result[0].success == 'false') { 
alert(result[0].errors.message); 

}

Now I want to use this custom button in visual force page and add that VF page on feed view, this is what I did with VF page:

<apex:page standardController="Case" extensions="CaseController" tabStyle="Case" >
  <apex:form >
  <apex:commandButton action="{!URLFOR($Action.Case.Escalate, Case.Id)}" value="Escalate"/>
  </apex:form>
</apex:page>

I added above VF page on feed view layout and it shows up the custom button as seen below

Escalate Button

but when I click the button, it doesn't execute the java scripts and shows the following windows after button click

Escalate After Click

Thanks in advance for help!

P
Hello, I'm working on integeration of SF with external application and need help wiht JSON and arrays

The following code is working fine and I'm getting what I need:

 Map<String,Object> msg = new Map<String,Object>();
        
 msg.put('channel', '#mychannel');
 msg.put('text', 'Here is my case number');
 msg.put('mrkdwn', true);
 String body = JSON.serialize(msg);

To extend above code, I need to achieve following JSON and not sure I can get this. Hope someone can help with this.
{
   "channel": "#mychannel"
    "text": "Here is my case number",  
    "attachments": [
        {
            "text": "And here is an attachment!",
            "color":"good",
            "footer":"End of Message"
        }
    ]
}


Thanks in advance,
P
Hello, I need help to develop trigger to insert record to grand child table. Here is the need. 

When a new task is created, I want to add this as a note and link to the task. New notes used contentnote and contentdocumentlink tables. I developed a trigger on object task and was successfully able to insert note in but to link note to the task I need to insert record contentdocumentlink object and that is where I need help.

here is the trigger on task to insert record in note table:

trigger createNotes on Task (after insert) {
    
    List<ContentNote> NotesToInsert = new List<ContentNote> ();
    
    for (Task t : Trigger.new){
        
        if (t.Status_Update__c == 'insert note') {  
        
        ContentNote n = new ContentNote (); 
             
        n.Title = 'Inserted from Task'; // using fixed value for testing
        n.Content = Blob.valueOf(t.Status_Update__c.escapeHTML4()); 
        
        NotesToInsert.add(n);
       
        
        }//end if
        
    }//end for o
    
    //once loop is done, you need to insert new records in SF
    // dml operations might cause an error, so you need to catch it with try/catch block.
    try {
        insert NotesToInsert; 
    } catch (system.Dmlexception e) {
        system.debug (e);
    }
    
The next step is to insert into ContentDocumentLink, here is what need to inserted

ContentDocumentLink.ContentDocumentId will be ContentNote.Id from notes table
ContentDocumentLink.LinkedEntityId will be task.Id from task table
ShareType will be "V" //fixed value
Visibility vill be "AllUsers" //fixed value

The one way could be write a trigger on Contentnote which I don't want since data in ContentNote will be coming from other areas in Salesforce as well.

Look forward to hear from experts.

Thanks in advance,
P
 
Hello,

I have following visual force page which passes the value to report paramets and it works fine in classic view. We are experimenting with Lightning and the same VF page is not passing parameters to the report. Can someone help what I need to change to make it work in both Lightning and Classic view.


<apex:page standardController="Account">
<p> <a href="/00OC0000006Fv2i?pv0='Technical'&pv1={!SUBSTITUTE(Account.Name,'&', '%26')}" target="_blank">Give me list of <b><font color="Red">Technical Contacts</font></b> for biller {!Account.Name}?</a> </p>
</apex:page>

Thanks for the help in advance.

Parv
Hello all,

I'm trying to include body of the email in auto reponse email using {!Case.Email_Thread} but it is not working. I reached out to SF support and according to them it is working as expected and email thread doesn't work in auto response template. Also they suggested that I need to develop VF template and/or apex code to achive this functionality and that is the reason I'm posting my question here to get help. 

Thanks in advance,

Parv
Hello,
I'm creating a visual page page to show custom link to reports and everything worked great.
I have few custom fields on account object which I will use to show custom link and I need help to use if condition something like this

if account.Relation = "Partner" then show link to a report
else if account.relation = "Customer" then show link to another report
else don't show link at all.

I'm sure it is achieveable but need help.

Thanks,
P​​​​​​
Hello all,

I created a custom button on Case object and purpose of the button is to escalate the case. Here is the code and it works great.

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

var caseObj = new sforce.SObject("Case"); 
caseObj.id = '{!Case.Id}'; /* Need Id field to update Case */ 

if ({!Case.IsEscalated} == 0) 

caseObj.IsEscalated= 1; 
}; 


/* Change escalated field */ 

/* update method takes an array of Cases; init to 1 element - 'caseObj' */ 
var result = sforce.connection.update([caseObj]); 

if (result[0].success == 'false') { 
alert(result[0].errors.message); 

}

Now I want to use this custom button in visual force page and add that VF page on feed view, this is what I did with VF page:

<apex:page standardController="Case" extensions="CaseController" tabStyle="Case" >
  <apex:form >
  <apex:commandButton action="{!URLFOR($Action.Case.Escalate, Case.Id)}" value="Escalate"/>
  </apex:form>
</apex:page>

I added above VF page on feed view layout and it shows up the custom button as seen below

Escalate Button

but when I click the button, it doesn't execute the java scripts and shows the following windows after button click

Escalate After Click

Thanks in advance for help!

P
Hello, I'm working on integeration of SF with external application and need help wiht JSON and arrays

The following code is working fine and I'm getting what I need:

 Map<String,Object> msg = new Map<String,Object>();
        
 msg.put('channel', '#mychannel');
 msg.put('text', 'Here is my case number');
 msg.put('mrkdwn', true);
 String body = JSON.serialize(msg);

To extend above code, I need to achieve following JSON and not sure I can get this. Hope someone can help with this.
{
   "channel": "#mychannel"
    "text": "Here is my case number",  
    "attachments": [
        {
            "text": "And here is an attachment!",
            "color":"good",
            "footer":"End of Message"
        }
    ]
}


Thanks in advance,
P
Hello, I need help to develop trigger to insert record to grand child table. Here is the need. 

When a new task is created, I want to add this as a note and link to the task. New notes used contentnote and contentdocumentlink tables. I developed a trigger on object task and was successfully able to insert note in but to link note to the task I need to insert record contentdocumentlink object and that is where I need help.

here is the trigger on task to insert record in note table:

trigger createNotes on Task (after insert) {
    
    List<ContentNote> NotesToInsert = new List<ContentNote> ();
    
    for (Task t : Trigger.new){
        
        if (t.Status_Update__c == 'insert note') {  
        
        ContentNote n = new ContentNote (); 
             
        n.Title = 'Inserted from Task'; // using fixed value for testing
        n.Content = Blob.valueOf(t.Status_Update__c.escapeHTML4()); 
        
        NotesToInsert.add(n);
       
        
        }//end if
        
    }//end for o
    
    //once loop is done, you need to insert new records in SF
    // dml operations might cause an error, so you need to catch it with try/catch block.
    try {
        insert NotesToInsert; 
    } catch (system.Dmlexception e) {
        system.debug (e);
    }
    
The next step is to insert into ContentDocumentLink, here is what need to inserted

ContentDocumentLink.ContentDocumentId will be ContentNote.Id from notes table
ContentDocumentLink.LinkedEntityId will be task.Id from task table
ShareType will be "V" //fixed value
Visibility vill be "AllUsers" //fixed value

The one way could be write a trigger on Contentnote which I don't want since data in ContentNote will be coming from other areas in Salesforce as well.

Look forward to hear from experts.

Thanks in advance,
P
 
Hello,
I'm creating a visual page page to show custom link to reports and everything worked great.
I have few custom fields on account object which I will use to show custom link and I need help to use if condition something like this

if account.Relation = "Partner" then show link to a report
else if account.relation = "Customer" then show link to another report
else don't show link at all.

I'm sure it is achieveable but need help.

Thanks,
P​​​​​​