• Apurva Dutta 8
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 1
    Replies
Hi Guys,

Need your hep and advice here. I have a custom button on Case object that has been overridden with a custom url. Also, earlier we had only 1 record type in Case. So, when a user click's the custom case button from Opportunity he is by default redirected to case creation page hence the solutions work flawlessly. But now we have introduced another record type in Case. So, the issue is whenever a user is clicking on the custom case button from opportunity, he doesnot get to select the record type and is re-directed to deflaut record type that is selected in in profile.

So, my doubt here is 

1. Can we write a javascript to update the code on the custom button to show the user the record type selection page.
2. After user selects the desired record type can we pass some information from opportunity to Case through javascript? 

Here is the code that exsitited before

/500/e?retURL=%2F500%2Fo

&cas4_lkid={!Account.Id}

&cas4={!Account.Name}

&00Nc00000014jDM={!Opportunity.Id}

&CF00Nc00000014jDC={!Opportunity.Name}

&CF00Nc00000014jGQ={!Opportunity.Amount}

&CF00Nc00000014Vww={!Opportunity.TDM_Program_Manager__c}

&CF00Nc0000001570L={!Opportunity.TDM_Publisher__c}

&CF00Nc00000014Vwr={!Opportunity.OwnerId}

&cas3_lkid={! NULLVALUE (Case.ContactId, Contact.Id )}

&cas3={! NULLVALUE (Case.Contact, Contact.Name )}

&retURL=/500/o
  
&saveURL=/500/o

Also, if you experts have any psuedu code for the same i would be really gratefull. 

Thanks A Lot.
Hi,

I have two Objects Case and Case_Action__c. Whenever a case's Contract status is changed to Rejected, it should create a record in Case Action Object. Now, if the Case Action status is changed to "Resubmitted", the case's contract status should also be updated to "Resubmitted" and in a Date time field the Date/Time should get capture. Now, if Case's Contract statsu is again changed to "Rejected", it should again create a Case Action record. Now, if 2nd Case action status record is updated to "Resubmitted", it should update the case's contract status field to "Resubmitted" , but the date/time should be capture in the second date/time field. 

I have come up with below trigger, which populates the 1st date/time field but not the second one.  Could anybody please tell me what i am doing wrong here?

trigger updateCaseOwner on Case_Action__c (before update)
{
  
    Map<Id,Case_Action__c> casActonMap = new Map<Id,Case_Action__c>();
    casActonMap = Trigger.OldMap;
    Set<Id> casID = new Set<Id>();
    Integer Count =0;
    List<Case> casLst = new List<Case>();
    for(Case_Action__c casActon : trigger.new)
    {
        casID.add(casActon.Case__c);
    }
   
    List<Case> casObjLst = [Select Id,Contract_Status__c,Sales_Resubmit_Comments__c,Sales_Resubmission_Date__c,X2nd_Sales_Resubmission_Date__c from Case where Id in : casID];
   
    for(Case_Action__c casActonObj : Trigger.new)
    {
       
        Case_Action__c casActnOld = new Case_Action__c();
        casActnOld = casActonMap.get(casActonObj.Id);
        if(casActonObj.Status__c == 'Resubmitted' && casActnOld.Status__c != 'Resubmitted')
        { 
            for(case cas :casObjLst)
            {
            //Count = 0;
            system.debug('cas.Sales_Resubmission_Date__c----'+cas.Sales_Resubmission_Date__c);
            system.debug('cas.X2nd_Sales_Resubmission_Date__c------'+cas.X2nd_Sales_Resubmission_Date__c);
            system.debug('Count----'+Count);
                if(Count == 0 && cas.Sales_Resubmission_Date__c == null)
                {
                    System.debug('Checking if entering into the loop-------');
                    cas.Contract_Status__c = 'Resubmitted';
                    cas.Sales_Resubmit_Comments__c = casActonObj.Resubmit_Comments__c;
                    cas.Sales_Resubmission_Date__c = System.now();
                    Count++;
                    system.debug('Count--1--'+Count);
                    casLst.add(cas);
                }
                else if( count == 1 && cas.Sales_Resubmission_Date__c != null)
                {
                   system.debug('Count--2--'+Count);
                   System.debug('Checking else entering into the loop----1---');
                   cas.Contract_Status__c = 'Resubmitted';
                   cas.Sales_Resubmit_Comments__c = casActonObj.Resubmit_Comments__c;
                   cas.X2nd_Sales_Resubmission_Date__c = System.now();
                   casLst.add(cas);
                } 
                Count++;
            }
        }
    }
    system.debug('Count--3--'+Count);
    //Count++;
    system.debug('Count--4--'+Count);
    system.debug('casLst------'+casLst);
    update casLst;
}

Thank You.
Hi,

I have a requirement. I have a lookup field(user) on opportunity which when filled and opportunity is saved, the user should be automatically inserted into opportunity team members with edit access. Could anyone please help me in achaiving this. I know we have to write an apex trigger so any help would be really appriciated.

Thanks.
Hi All,

I am unable to pass the custom field values to the below alert box. My scenario is like when i click on the custom button, i need to pass item_id__c via url to open the visual page. 

var Account = "{!Account.Id}";
var AccountName = "{!Account.Name}";
var ItemName= "{!Account.Item_ID__c}";
if(Account!=null)
{
alert('Account'+ItemName);
window.open('https://www.google.com?item='+ItemName);
}
  • February 04, 2015
  • Like
  • 0