• 15 Points
  • Member since 2014

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 5
Hi all,

I have a scenario. Whenever i click on a custom button it will call the apex class. The class consists of some webservice call. That means when i click on button it will call the webservice end point.. We can achieve this by creating VF page and Apex class but i dont want to create a VF page.

How to do this..
Help on this.. 
Need help in code coverage for constructor with parameters(controller).
PScRMAExtension_v1  is CONTROLLER

    *Class constructor
    public PScRMAExtension(PScRMAExtension_v1 objext)
        system.debug('$$$ <PScRMAExtension::PScRMAExtension>');
        parent_case_id = ApexPages.currentPage().getParameters().get('id');
        //parent_case_id = '50011000008KcEV';
        //currentInstance = this;
        //case_list = (Case)controller.getRecord();
        RMALineItemCnt = 0;
        show_RMA_list = FALSE;
        showAdvanceExchange = FALSE;
        show_flash_alert = FALSE;
        show_expired_contract_alert = FALSE;
        accept_expired_contact = FALSE;
        show_case_detail = FALSE;
        show_fru_detail = FALSE;
        asset_exists = FALSE;
        show_cli_grid = FALSE;
        show_asset_grid = TRUE;
        disable_save_btn = FALSE;
        show_add_line_item = FALSE;
        show_expired_Asset_alert =FALSE;
        isRMASLASameDay = false;
        isshowRMAexits =FALSE;
        //show_replacement_part_confirmation = FALSE;
        //accept_replacement_part = FALSE;

        RMA_line_item_wrapper_list = new List<PScRMALineItemsWrapper>();
        new_line_item_obj = new RMA_Line_Items__c();
        RMA_line_item_list = new List<RMA_Line_Items__c>();
        view_line_item_obj = new RMA_Line_Items__c();
        line_save_text = 'Add Line Item';
        obj_line_item_tosave = new List<RMA_Line_Items__c>();

        rmaAssignedRtName = '';
        primaryOwnerFld = '';
        secondaryOwnerFld = '';
        default_country = 'United States';

        //replacement_part_error_msg = '';
        system.debug('show_add_line_item1' + show_add_line_item);

        //stateList = new List<selectOption>();
        //stateList.add(new selectOption('', '--None--'));

        //system.debug('$$$ parent_case_id: ' + parent_case_id);
        if(parent_case_list == null)
            parent_case_list = [ SELECT Account.Name, Account.Company_Name__c, Account.ShippingStreet, Account.ShippingCity, Account.ShippingState, Account.ShippingCountry, Account.ShippingPostalCode, Account.Phone, Account.Email__c, Contact.Name, Contact.MailingStreet, Contact.MailingCity, Contact.MailingState, Contact.MailingCountry, Contact.MailingPostalCode, Contact.Phone, Contact.Email, AccountId, ContactId, AssetId, CaseNumber, Subject, Description, Status, Priority, Severity__c, Serial_No__c, Platform__c, Product_Series__c, Ship_To_Account__c FROM Case WHERE Id = :parent_case_id ];
            account_id = parent_case_list.AccountId;
            asset_serial_no = parent_case_list.Serial_No__c;

            if(parent_case_list.Account.Company_Name__c != null)
                account_name = parent_case_list.Account.Company_Name__c;
                account_name = parent_case_list.Account.Name;

        system.debug('$$$ parent_case_list: ' + parent_case_list);

        List<CreateCaseRT__c> ccRtList = CreateCaseRT__c.getAll().values();
        if(ccRtList.size() > 0)
            for(CreateCaseRT__c t : ccRtList)
                if(t.Case_Trans_Type__c == system.label.RMA_Transaction_Type)
                    rmaAssignedRtName = t.Name;

        system.debug('in PScRMAExtension show_cli_grid ' + show_cli_grid);
        system.debug('in PScRMAExtension show_asset_grid ' + show_asset_grid);
  • March 11, 2016
  • Like
  • 1

We are receiving the warning email from salesforce following the execution of an Apex function. There is no indication of what class this is referring to, so we cannot debug. Is there a way to figure out the class is the root cause.

I have created a visual force page. i am creating Opportunity record through the contact related list. So after 'New'  is asks record type selection then opens custom VF page. after save the Opportunity record doesnt appear in the contact related list. Please help me.

The contact related list  'New'  button is also custom button.
Hi ,
I am trying to change the contact owner of the contact on insert and I am directed to the page saying insufficient permission.
The profile has a limites access on contact that is only read edit and create. Change the Owner option is available in the UI but unable to control on the edit page
Here is the code
trigger UpdateCOwner on Contact (before insert, after insert)
//Query for the ARS Account Leader of the contact's Account 
//Set the contact ARS Owner value to Leader value obtained 
//Insert Record 
Contact c = new Contact();
Map<String, Contact> contactMap = new Map<String, Contact>();
for (Contact contact : System.Trigger.old) 

if (System.Trigger.isInsert)
string profileName = [select profile.name from user where id = :contact.OwnerId][0].profile.name;
if(profileName.indexOf('Call Center')>-1)
Account acnt = [select ARSaccountleader_lookup__c,ACWaccountleader_lookup__c from Account where Id=:contact.AccountId];
string acntLeader = [select ARSaccountleader_lookup__c from Account where Id=:contact.AccountId][0].ARSaccountleader_lookup__c;
//string acntLeader = [select ARSaccountleader_lookup__c from Account where Id=:contact.AccountId][0].ARSaccountleader_lookup__c;
//string test = acnt.ACWaccountleader_lookup__c;
contact.Created_by_Call_Center__c = true;
if(acnt.ARSaccountleader_lookup__c != null)
contact.OwnerId = acnt.ARSaccountleader_lookup__c;
else if (acnt.ACWaccountleader_lookup__c != null)
contact.OwnerId = acnt.ACWaccountleader_lookup__c;
//c = contact;

else contactMap.put(contact.Id,contact);

Can some one help with finding how this can be handled.A use with limited profile cannot create a contact with the differnt owner and this causing the problem.
Is there a way we can update the record after insert
Thanks in advance.
Thanks & Regards,

Message Edited by Suchitra on 03-07-2008 08:34 AM