• Anurag Jain
  • NEWBIE
  • 105 Points
  • Member since 2014
  • Sr Salesforce Developer


  • Chatter
    Feed
  • 4
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 19
    Replies
I need to create some custom buttons with Javascript, but I can't find any tutorial/API documentation as it applies to custom buttons.

I'm on PE, so can't use Apex as I understand.

Can someone point me in the right direction to any documentation resources please?

Thanks
  • July 24, 2014
  • Like
  • 0
How to Open SubChild Window through Child Window when My Child Window is Open using Java Script?
I'm trying to open child window and then turough child window i m trying to open subchild window,but when i m open subchild window my child window get closed and subchild window open
PlZ Help??
I want to write validation Rule for case comments. SO if any users wants to delete/update  the case comments then it wont allowed deletion or modification. But i saw that there is no field like comments in the case fields. Then how could i acheive this ?


User-added image
  • March 25, 2014
  • Like
  • 0
The trigger looks at the Ticket__c(Custom Object) record whose status (GLOBAL_Ticket_Status__c == 'closed')  and updates case($Object) Status(Field) to closed
 
Ticket__c has a lookup to Case, so case can have multiple tickets associated to it but a ticket can only be associated to a case. 

Trigger Ticket on Ticket__c (after insert, after update) {
    Set<Id> closedTicketIds = new Set<Id>();
            for (Ticket__c ticket: Trigger.new) {
            if (ticket.GLOBAL_Ticket_Status__c == 'closed' && ) {
            closedTicketIds.add(ticket.id);
        } 
    }
    List<Ticket__c> ticketForClosing= [SELECT Id, GLOBAL_Goal__c FROM Ticket__c
                                         WHERE Id IN: closedTicketIds];

    set<Id> caseIDs = new set<Id>();
        for(Ticket__c t : ticketForClosing){
        caseIDs.add(t.GLOBAL_Goal__c);
    }
    List<Case> casesToUpdate = new List<Case>();
        for (Case c : [Select Id, Status From Case Where Id In : caseIDs]) {
        c.Status = 'closed';
        casesToUpdate.add(c);
    }
   
    update casesToUpdate;
}

1. The  issue is trigger does not look at all the records of ticket (Requirement is to look at all the records of ticket and only if the status(GLOBAL_Ticket_Status__c == 'closed') then go and close the Case) ,Currently trigger closes a case if either of the tickets sociated to the case are closed but not all.

2. Change the status on case 7 days after all the tickets associated to that case are closed(this allows the business to add tickets to the same case)


Can anyone please help me out on this

Thanks

Hi SF world,

My requirment is to create exact copy of 1 salesforce instance to another including every setting like pagelayout, custom setting, meta data, custom code, 3rd party installed packages, data etc, similar way like full copy sandbox does but i want to clone develper edition.

I know one option is to do it manually using IDE or ANT it is very time consuming, is there any way i can do it more quickly?

Thanks 
Anurag Jain
Hi all,

I am using following code to genrate sign, It is working fine in summer 16 salesforce release but my org it autmatically upgraded to winter 17 and this code starts giving follwoing exception:-

"EXCEPTION: System.SecurityException: Invalid Crypto Key
STACKTRACE: Class.System.Crypto.sign: line 35, column 1
AnonymousBlock: line 7, column 1
AnonymousBlock: line 7, column 1
LINE: 35 COLUMN: 1"


can any one help me on this???
string modifiedPrivateKey = 'MIIEpAIBAAKCAQEA1l9J+lUhM3RIADiLy2ajqUjltBqSVMthUlNnu8GsN4z85aniBIDebY+RkFhKDDW9hu8xM/Q4NEI7klmCVWI5BnobWfUjRbhd9oW94qBP7B1Ka6BsSn3RbfvGZZLcDNXd6806acpgMn79fjYPUQPI1kSfrd1GeMDQDGtNFsnCTd9zq2Vye4RQJrlDzC7g70i3jEHCh853ifD4MaQwo+SWf/eF7bLqA+81qUB2llRyA7SH9YF1I/ZmgH57MVTXb62HRMr/JxERDOerHLt7CK9hdbmM3vpRZz8MJnIMrNJKXXbxS69F8aLK7q+8i8xkl1IRwWVD9uJJaWpz7NEBs9EenwIDAQABAoIBACRDLjJoYBtiGiPfbNZVYG3sZN7Yd9RcKvRQI4YBNu6WrNj0qcT1P6rs1ETEipISLSM8JuiQ8Uj1wzn4ZjGnUdokoafP7c2HaG2hJgPF9n8MXWBjXK4lJl4ibucTtqF9M/MFXlIy557jGGJXJrQfncORDCnO+nLGuuq+4+Vs769YQ+bfj69pzfo4kUKaZRj6tgDcAo9Owbe6b7t1gGIM1fo+1fnyZrgYUxwor6periyvjefJaw8N78ASXbu9zHvVrbqaZmwXRJqCRRm8yYigGwQoxLX1DEryrSSCOEZWNUYzG+Det8XuvmsfR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2tlbiIsImp0aSI6InRKVFRwUklmRFhFUlNkNjFBS0hIam9wUm41ZEVSMjBMIiwiZXhwIjoxNDc2MDg4ODA4fQ';
string jwtHeader = 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InAwbXE4aHZqIn0';
String algorithmName = 'RSA-SHA256';
Blob input = Blob.valueOf(jwtHeader + '.' + jwtClaims);
Blob privateKeyBlob = EncodingUtil.base64Decode(modifiedPrivateKey);
Blob signed = Crypto.sign(algorithmName, input, privateKeyBlob);
Thanks Anurag
 
Hi All,

Is their any way in Salesforce to view(or apex code) remaining Mass Email limits for a day??

Thanks
is there any way to hide standard Lead object Record from global search for System Admin???
Hi all,

I am using following code to genrate sign, It is working fine in summer 16 salesforce release but my org it autmatically upgraded to winter 17 and this code starts giving follwoing exception:-

"EXCEPTION: System.SecurityException: Invalid Crypto Key
STACKTRACE: Class.System.Crypto.sign: line 35, column 1
AnonymousBlock: line 7, column 1
AnonymousBlock: line 7, column 1
LINE: 35 COLUMN: 1"


can any one help me on this???
string modifiedPrivateKey = 'MIIEpAIBAAKCAQEA1l9J+lUhM3RIADiLy2ajqUjltBqSVMthUlNnu8GsN4z85aniBIDebY+RkFhKDDW9hu8xM/Q4NEI7klmCVWI5BnobWfUjRbhd9oW94qBP7B1Ka6BsSn3RbfvGZZLcDNXd6806acpgMn79fjYPUQPI1kSfrd1GeMDQDGtNFsnCTd9zq2Vye4RQJrlDzC7g70i3jEHCh853ifD4MaQwo+SWf/eF7bLqA+81qUB2llRyA7SH9YF1I/ZmgH57MVTXb62HRMr/JxERDOerHLt7CK9hdbmM3vpRZz8MJnIMrNJKXXbxS69F8aLK7q+8i8xkl1IRwWVD9uJJaWpz7NEBs9EenwIDAQABAoIBACRDLjJoYBtiGiPfbNZVYG3sZN7Yd9RcKvRQI4YBNu6WrNj0qcT1P6rs1ETEipISLSM8JuiQ8Uj1wzn4ZjGnUdokoafP7c2HaG2hJgPF9n8MXWBjXK4lJl4ibucTtqF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jvUK4Rc5LA0K';
string jwtClaims = 'eyJpc3MiOiJ5bnFpNTYzc3hzMDh4ZWR6ajM2a29lenduczZ1ZmRyMCIsInN1YiI6IjI4NTc5Mzg5NCIsImJveF9zdWJfdHlwZSI6InVzZXIiLCJhdWQiOiJodHRwczovL2FwaS5ib3guY29tL29hdXRoMi90b2tlbiIsImp0aSI6InRKVFRwUklmRFhFUlNkNjFBS0hIam9wUm41ZEVSMjBMIiwiZXhwIjoxNDc2MDg4ODA4fQ';
string jwtHeader = 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InAwbXE4aHZqIn0';
String algorithmName = 'RSA-SHA256';
Blob input = Blob.valueOf(jwtHeader + '.' + jwtClaims);
Blob privateKeyBlob = EncodingUtil.base64Decode(modifiedPrivateKey);
Blob signed = Crypto.sign(algorithmName, input, privateKeyBlob);
Thanks Anurag
 
Hey All,

I have a trigger which i thought was bulkified, however when mass updating records through gridbuddy i still get the to many soql queries error.

Any help is appreciated.

below is the code of the trigger.

the map query is where it errors: 
 
trigger Fill_OneOff_Lookups on VG_One_Off_Planning__c (before update, before insert) {
            
            system.debug('test1 in trigger');
    
            list<id> UserIDs = new list<id>();
    		list<User> CurrentUsers = new list<User>();
    
            for (VG_One_Off_Planning__c OneoffLine : trigger.new)
            {               
                system.debug('test2 in for ' + OneoffLine);
                
                if(OneoffLine.ContactID__c != null)
                {
                	OneoffLine.Contact__c = OneoffLine.ContactID__c;
                }
                                
                if(OneoffLine.Al_ID__C != null)
                {
                	OneoffLine.Account_Location__c = OneoffLine.AL_ID__c;
                }
                OneoffLine.Account__c = OneoffLine.Location_Account_ID__c;                 
                system.debug('test3 in trigger' + OneoffLine.User_Id__c);
                if(OneoffLine.User_ID__c != null)  
                {
                	boolean ExecuteCode = true;
                   	/* if(trigger.IsUpdate){
                    
                        VG_One_Off_Planning__c OldPlanningRecord = System.Trigger.oldMap.get(OneOffLine.Id);
                        system.debug('test3 in trigger update' + OldPlanningRecord);
                        if(OneoffLine.User_ID__c == OldPlanningRecord.User_ID__c){
                            ExecuteCode = false;
                        }
                    }*/
                	system.debug('test4 ' + ExecuteCode);                
                	//if(ExecuteCode == true){               
                	UserIDs.add(Id.valueOf(Oneoffline.User_ID__c)); 
                }
            }         
    
    		Map<Id,User> GetUsers = new map<Id,User>([SELECT Id, IsActive FROM User WHERE Id in :UserIDs]);
    		currentusers = GetUsers.values();
    
    
    		for (VG_One_off_Planning__c oneoff : trigger.new)
            {
               	for(integer index =0; index <  CurrentUsers.size(); index++)
                {
                	if(CurrentUsers[index].IsActive == true && oneoff.User_ID__c == CurrentUsers[index].Id )
                	{             
                		Oneoff.OwnerId = Oneoff.User_ID__c;
                	}
				}
			}
}

With kind regards,
Thomas
Hi,

I want to convert a datetime field to date field in javsscript

var date=record.LastModifiedDate;

what is the method i can use to convert it


i am currently using the below format

var date = new Date(record.LastModifiedDate);
console.log(date.toISOString().slice(0,10));


but its displaying in the below format which is wrong

Fri May 09 2014 10:30:50 GMT+0530 (India Standard Time)

i want it in below format

2014-05-09

Thanks
I need to create some custom buttons with Javascript, but I can't find any tutorial/API documentation as it applies to custom buttons.

I'm on PE, so can't use Apex as I understand.

Can someone point me in the right direction to any documentation resources please?

Thanks
  • July 24, 2014
  • Like
  • 0
How to Open SubChild Window through Child Window when My Child Window is Open using Java Script?
I'm trying to open child window and then turough child window i m trying to open subchild window,but when i m open subchild window my child window get closed and subchild window open
PlZ Help??
Hi,
        Actually i displayed all objects in a pageblocktable.One of the column is OwnercreatedDate.How to retrieve Object created dates in a ownercreatedDate table column?

help me..........
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
trigger autoContact on Account (after insert) {
   
    List<contact> newContact = new List<contact>();
   
  
    for(Account acc: Trigger.new){
      
            Contact con = new Contact();
            con.FirstName = acc.Name;
            con.LastName = acc.Short_Name__c;
            con.Phone = acc.Phone;
            con.salutation = 'Mr.';
            con.AccountId = acc.id;
            newContact.add(con);
      }
           insert newContact;
     }
====================================================================

@isTest
Public Class autoContactTest{
    Static testmethod void MethodOne(){
        Account a = new Account();
        a.Name = 'ABVP';
        a.Phone = '0000000000';
        a.Short_Name__c = 'Abi';
       
        insert a;
       
        Contact c = new Contact();
        c.FirstName = 'ABVP';
        c.LastName = 'Abi';
        c.Phone = '0000000000';
        c.AccountId = '0019000000tgMdl';
        insert c;
          }
}

thanks in adv...:)
I want to write validation Rule for case comments. SO if any users wants to delete/update  the case comments then it wont allowed deletion or modification. But i saw that there is no field like comments in the case fields. Then how could i acheive this ?


User-added image
  • March 25, 2014
  • Like
  • 0
is there any way to hide standard Lead object Record from global search for System Admin???
The trigger looks at the Ticket__c(Custom Object) record whose status (GLOBAL_Ticket_Status__c == 'closed')  and updates case($Object) Status(Field) to closed
 
Ticket__c has a lookup to Case, so case can have multiple tickets associated to it but a ticket can only be associated to a case. 

Trigger Ticket on Ticket__c (after insert, after update) {
    Set<Id> closedTicketIds = new Set<Id>();
            for (Ticket__c ticket: Trigger.new) {
            if (ticket.GLOBAL_Ticket_Status__c == 'closed' && ) {
            closedTicketIds.add(ticket.id);
        } 
    }
    List<Ticket__c> ticketForClosing= [SELECT Id, GLOBAL_Goal__c FROM Ticket__c
                                         WHERE Id IN: closedTicketIds];

    set<Id> caseIDs = new set<Id>();
        for(Ticket__c t : ticketForClosing){
        caseIDs.add(t.GLOBAL_Goal__c);
    }
    List<Case> casesToUpdate = new List<Case>();
        for (Case c : [Select Id, Status From Case Where Id In : caseIDs]) {
        c.Status = 'closed';
        casesToUpdate.add(c);
    }
   
    update casesToUpdate;
}

1. The  issue is trigger does not look at all the records of ticket (Requirement is to look at all the records of ticket and only if the status(GLOBAL_Ticket_Status__c == 'closed') then go and close the Case) ,Currently trigger closes a case if either of the tickets sociated to the case are closed but not all.

2. Change the status on case 7 days after all the tickets associated to that case are closed(this allows the business to add tickets to the same case)


Can anyone please help me out on this

Thanks