• Jamz_2010
  • NEWBIE
  • 250 Points
  • Member since 2009

  • Chatter
    Feed
  • 10
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 43
    Questions
  • 51
    Replies

Hi All,

 

I need to create hundreds of custom labels.

 

I have these labels in properties file as below.

UserName=User Name

Password=Password

 

Can we create them using apex code or we need to create them one by one from App Setup -> Custom Labels -> New Custom Label ?

 

Could anyone please help me on this

 

Thanks.

We are using Professional Edition. 

 

When I mass import new leads via Lead Import Wizard, I can't find the custom lookup relationship fields on the field mapping page. (All lookup fields are included in the import file) Therefore, all the mapped fields have been imported, but all lookup relationship fields.

 

I would very much appreciate, if anyone can tell me reason and how can I import them?

 

Many thanks

Yvonne

Hi,

 

I get this error when trying to deploy code to my Winter 13 sandbox but not on any of the others. Also, when I run tests as the deployment User in the Winter 13 sandbox there are no test failures. This is occurring when I'm trying to create Content for the Test Methods (I have checked and the deployment User definately has "Library Administrator" permissions on the Content Library)...

 

Does anyone know what this might be happening?

 

Cheers

 

James

Hi,

 

I'm just using the XMLStreamWriter to generate an XML String which I am then passing to a web service. I need to generate a string that starts:

 

 

<?xml version="1.0" standalone="no"?>
<!DOCTYPE PRICEREQUEST SYSTEM  \'http://164.39.41.88:81/PriceCheckerDTD1.0/PriceRequestIN.dtd\'>

So far I have:

 

 

XmlStreamWriter w = new XmlStreamWriter();
w.writeStartDocument(null, '1.0');

But I can't see anyway of adding the standalone attribute to the document start or the DOCTYPE tag to the next line.

 

Does anyone know how this can be achieved using the XMLStreamWriter?

 

Cheers

 

James

 

 

 

Hi,

 

Would anyone be able to let me know the limitations (or location of a document that provides these limits) for the following items?

 

 

  • Record Types
  • Page Layouts
  • Items in a Picklist
  • Formula Fields (I am aware that there is a 500 field limit per object but is there a specific limit for the number of formula fields?)
I'm sure there was a document stating this but I can't find it anywhere...
Cheers
James

 

Hi all,

 

Does anyone know how I can specify a PageReference to take the user to the homepage? I know I can use:

 

 

return new PageReference('/home');

 

 

but I don't know if this is very extensible. Does anyone know the official, Salesforce way of doing this?

 

Cheers

 

James

Hi all,

 

I need to get the week of the year for a Salesforce project but am having some problems, I have tried using

 

 

System.Now().Format('w') ;

 

which should return the current week but this doesn't seem to work (it returns the wrong week of the year - for instance this week is week 21 and this returns week 22. For the business purposes the first week of the year is the week starting with the first Monday in January (this year that is w/c 04/01/2010). Does anyone know how you can do this in Salesforce?

 

Cheers

 

James

Hi all,

 

I have setup a Web Service to use for the Delegated Single Sign On within Salesforce and placed the endpoint in the Delegated Gateway URL within Salesforce but am getting the following error:

 

 

Cannot find dispatch method for {urn:authentication.soap.sforce.com}Authenticate

 

Salesforce have checked on the server and the request log says:

 

 

 

<?xml version="1.0" encoding="UTF-8" ?> 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 
 <soapenv:Body>
   <Authenticate xmlns="urn:authentication.soap.sforce.com"> 
     <username>sampleuser@sample.org</username>  
     <password>myPassword99</password>  
     <sourceIp>1.2.3.4</sourceIp>  
   </Authenticate> 
 </soapenv:Body> 
</soapenv:Envelope>

 

 

Response:

 

HTTP transaction to http://qa-extranet.geopostuk.com:80/EnterpriseDirectory/authenticate took 321 ms HTTP status code is 500 Server:Sun-Java-System-Web-Server/7.0
Date:Wed, 26 May 2010 16:43:23 GMT
X-powered-by:Servlet/2.5
Content-Type:text/xml;charset="utf-8"
Proxy-agent:Sun-Java-System-Web-Server/7.0
X-Cache:MISS from proxy-sjl.net.salesforce.com X-Cache-Lookup:MISS from proxy-sjl.net.salesforce.com:8080
Via:1.1 https-qa-customer, 1.0 proxy-sjl.net.salesforce.com:8080 (squid) Proxy-Connection:close

<?xml version="1.0" ?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><S:Fault xmlns:ns3="http://www.w3.org/2003/05/soap-envelope"><faultcode>S:Client</faultcode><faultstring>Cannot find dispatch method for {urn:authentication.soap.sforce.com}Authenticate</faultstring></S:Fault></S:Body></S:Envelope>

 

 

I have also checked the Web Service logs but nothing appears to be getting that far. Does anyone have any idea what this message means or how to fix it?

 

Thanks

 

James

Hi all,

 

Does anyone know what the Organisation Wide callout limit is per day?

 

I can only find the bit that says 10 per transaction but not the maximum calls per day.

 

Cheers

 

James

Hi all,

 

Is it possible to setup an email to be sent to a user when they are given access to a record via a manual sharing rule?

 

Cheers

 

James

Hi all,

 

Does anyone know how I can prevent users from being able to delete notes? The users still need to be able to create Notes but for traceability we need to prevent users deleting notes...

 

Any help would be great,

 

Cheers

 

James

Hi all,

 

I am just creating a new Note within an Apex method, does anyone know how I can add a new line to the text? I have tried all the standard escape characters but none of them seem to work...

 

Cheers

 

James

Hi all,

 

I am having some issues when attempting to create a user for the customer portal. I am running on a sandbox org and have created the portal. I have added the Enable Customer Portal User button to the contact page layout but when I view a Contact this button does not appear. I am logged in as an administrator. I had a similar problem with the "Allow Customer Portal Self-Registration" field but after changing the field level security settings I could see the field. Does anyone have an clues as to why the button would not appear on the page layout?

 

Thanks

 

James 

 

Hi,

 

Is there any way within Salesforce Sites to get the domain name to appear as my main domain name but still have a path to each separate page (i.e. not using an iFrame)?

 

Thanks

 

James 

Hi all,

 

I am currently trying to create a new VisualForce page that handles the creation of Accounts and Contacts. I have got the field "Parent Account" which I display by using:

 

 

<apex:inputField value="{!account.Parent}" required="true"/>

 

behind this is the Apex code:

 

 

public Account account { get { return accAccount; } set { accAccount = value; } }

 

 for some reason when I try to save the Account by using:

 

upsert accAccount;

 

 I get the error:

 

 

Error: j_id0:j_id1:j_id3:j_id4:j_id13:j_id16: An error occurred when processing your submitted information.

 

 appear next to the Parent Account field. Does anyone know what might cause this error and how it could be resolved?

 

Thanks

 

James 

 

 

 

 

Hi Guys (and Gals),

 

I have struck abit of a sticky wicket here, I am trying to create a lookup to CampaignMember but can seem to find it in the list of objects. Does anyone know how this can be achieved?

 

Thanks

 

James 

Hi all,

 

Is there any way of making a commandbutton run some apex code but not refresh on button click?

 

Cheers

 

James 

Hi,

 

I am just trying to write a test method for my class and I am getting the error:

 

 

Method does not exist or incorrect signature: Test.StartTest()

 

Does anyone know what might cause this? I have tried this in a blank class to ensure its not caused by any other code but I still get the same error.

 

Cheers

 

James 

 

 

Hi all,

 

I am getting the error:

 

 

INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session. Session not found, missing session key: 00DA0000000HWvb!ARkAQJ8YeEOP6HqR1R5qF8hTf9U6A8W09DLZgxFRKEnHiaHy1BbyY.GUSG0aHRr_F0SmCqPb_ySEG4wjJwHb2L1dVzFOR3aG

 

When I try to invoke my apex class externally, this seems to only happen for a new org that I have recently created (after the upgrade to Winter '10). I have checked and the code before to login and get the login session id and put it into the stub header:

 

 

sf.operations.login(sarrCredentials[0], sarrCredentials[1], sarrCredentials[2]);SessionHeader sh = new SessionHeader();sh.setSessionId(sf.operations.loginResult.getSessionId());stub.setHeader(new billAccountsServiceLocator().getServiceName().getNamespaceURI(), "SessionHeader", sh);stub.generateBills(); 

 

Does anyone know what I am doing wrong here?

 

Thanks

 

James 

 

Hi all,

 

Does anyone know if a LIST in Salesforce is ordered? I am basically, putting some items into the list and was wondering whether the items stored in a LIST are ordered (the order in which they were place in the LIST). I have ran some tests and it appears that they are but I just wanted to confirm this with someone.

 

Thanks

 

James 

Hi all,

 

I am having some problems setting the callout timeout in apex. I have a class generated by the WSDL2Apex tool which works fine but I can't seem to be able to change the timeout value. I have tried changing the value of the timeout__x variable that is generated but this doesn't seem to do anything, am I supposed to use this variable during my web service invokation? My code is:

 

 

//Generated by wsdl2apex

public class smsService {

public class sendsms_element {

public String[] sMobileNums;

  public String sMessage;

public String sFrom;

public String sOrganisationId;

private String[] sMobileNums_type_info = new String[]{'sMobileNums','http://www.w3.org/2001/XMLSchema','string','0','-1','true'};

private String[] sMessage_type_info = new String[]{'sMessage','http://www.w3.org/2001/XMLSchema','string','0','1','true'};

private String[] sFrom_type_info = new String[]{'sFrom','http://www.w3.org/2001/XMLSchema','string','0','1','true'};

private String[] sOrganisationId_type_info = new String[]{'sOrganisationId','http://www.w3.org/2001/XMLSchema','string','0','1','true'};

private String[] apex_schema_type_info = new String[]{'http://expwsms','true','true'};

private String[] field_order_type_info = new String[]{'sMobileNums','sMessage','sFrom','sOrganisationId'};

}

 

public class receiveSMSResponse_element {

public String return_x;

private String[] return_x_type_info = new String[]{'return','http://www.w3.org/2001/XMLSchema','string','0','1','true'};

private String[] apex_schema_type_info = new String[]{'http://expwsms','true','true'};

private String[] field_order_type_info = new String[]{'return_x'};

}

 

public class expwsmsHttpSoap11Endpoint {

public String endpoint_x = 'http://hosted.expw.com:8002/axis2/services/expwsms.expwsmsHttpSoap11Endpoint/';

public Map<String,String> inputHttpHeaders_x;

public Map<String,String> outputHttpHeaders_x;

public String clientCert_x;

public String clientCertPasswd_x;

public Integer timeout_x = 120000;

private String[] ns_map_type_info = new String[]{'http://expwsms', 'smsService'};

public String receiveSMS(String JobId,String SMSMessage,String MobileNo,String VMN,String Keyword,String AccountId,String Network,String RecievedDate) {

smsService.receiveSMS_element request_x = new smsService.receiveSMS_element();

smsService.receiveSMSResponse_element response_x;

request_x.JobId = JobId;

request_x.SMSMessage = SMSMessage;

request_x.MobileNo = MobileNo;

request_x.VMN = VMN;

request_x.Keyword = Keyword;

request_x.AccountId = AccountId;

request_x.Network = Network;

request_x.RecievedDate = RecievedDate;

Map<String, smsService.receiveSMSResponse_element> response_map_x = new Map<String, smsService.receiveSMSResponse_element>();

response_map_x.put('response_x', response_x);

WebServiceCallout.invoke(

this,

request_x,

response_map_x,

new String[]{endpoint_x,

'urn:receiveSMS',

'http://expwsms',

'receiveSMS',

'http://expwsms',

'receiveSMSResponse',

'smsService.receiveSMSResponse_element'}

);

response_x = response_map_x.get('response_x');

return response_x.return_x;

}

 

public String sendsms(String[] sMobileNums,String sMessage,String sFrom,String sOrganisationId) {

smsService.sendsms_element request_x = new smsService.sendsms_element();

smsService.sendsmsResponse_element response_x;

request_x.sMobileNums = sMobileNums;

request_x.sMessage = sMessage;

request_x.sFrom = sFrom;

request_x.sOrganisationId = sOrganisationId;

request_x.setTimeout(2000);

Map<String, smsService.sendsmsResponse_element> response_map_x = new Map<String, smsService.sendsmsResponse_element>();

response_map_x.put('response_x', response_x);

WebServiceCallout.invoke(

this,

request_x,

response_map_x,

new String[]{endpoint_x,

'urn:sendsms',

'http://expwsms',

'sendsms',

'http://expwsms',

'sendsmsResponse',

'smsService.sendsmsResponse_element'}

);

response_x = response_map_x.get('response_x');

return response_x.return_x;

}

}

 

public class sendsmsResponse_element {

public String return_x;

private String[] return_x_type_info = new String[]{'return','http://www.w3.org/2001/XMLSchema','string','0','1','true'};

private String[] apex_schema_type_info = new String[]{'http://expwsms','true','true'};

private String[] field_order_type_info = new String[]{'return_x'};

}

 

public class receiveSMS_element {

public String JobId;

public String SMSMessage;

public String MobileNo;

public String VMN;

public String Keyword;

public String AccountId;

public String Network;

public String RecievedDate;

private String[] JobId_type_info = new String[]{'JobId','http://www.w3.org/2001/XMLSchema','string','0','1','true'};

private String[] SMSMessage_type_info = new String[]{'SMSMessage','http://www.w3.org/2001/XMLSchema','string','0','1','true'};

private String[] MobileNo_type_info = new String[]{'MobileNo','http://www.w3.org/2001/XMLSchema','string','0','1','true'};

private String[] VMN_type_info = new String[]{'VMN','http://www.w3.org/2001/XMLSchema','string','0','1','true'};

private String[] Keyword_type_info = new String[]{'Keyword','http://www.w3.org/2001/XMLSchema','string','0','1','true'};

private String[] AccountId_type_info = new String[]{'AccountId','http://www.w3.org/2001/XMLSchema','string','0','1','true'};

private String[] Network_type_info = new String[]{'Network','http://www.w3.org/2001/XMLSchema','string','0','1','true'};

private String[] RecievedDate_type_info = new String[]{'RecievedDate','http://www.w3.org/2001/XMLSchema','string','0','1','true'};

private String[] apex_schema_type_info = new String[]{'http://expwsms','true','true'};

private String[] field_order_type_info = new String[]{'JobId','SMSMessage','MobileNo','VMN','Keyword','AccountId','Network','RecievedDate'};

}

 

Please help as I have checked loads of documentation but can't seem to find out how to do this (I have tried request_x.setTimeout(120000) and request_x.timeout__x = 120000 but these don't seem to work. How can I set the timeout for this request?

 

Thanks

 

James 

Message Edited by Jamz_2010 on 10-05-2009 08:46 AM
Message Edited by Jamz_2010 on 10-05-2009 08:46 AM
Message Edited by Jamz_2010 on 10-05-2009 08:51 AM

Hi all,

 

Does anyone know of a way I can use a list view custom button to iterate through all the records that have been selected (via the checkbox) in the list? If this is not possible, is there anyway I can achieve the same functionality through a VisualForce page (again using checkboxes to select the records required)?

 

Thanks

 

James 

I have developed below test class but not getting why i am getting below error,

System.NullPointerException: Attempt to de-reference a null object..
the id i am passing has having the value..any suggestion?

apex class:

public class GSDPartnerCloneWithSkillsController {

    public ApexPages.StandardController controller {get; set;}
    public GSD_Partner__c GSDP {get;set;}
    public ID newRecordId {get;set;}
    public Id OldGSDResourceId {get;set;}
    public Id NewGSDResourceId {get;set;}

    
    public GSDPartnerCloneWithSkillsController(ApexPages.StandardController controller) {

        this.controller = controller;
        GSDP = (GSD_Partner__c)controller.getRecord();

    }
    
    public PageReference cloneWithItems() {

         Savepoint sp = Database.setSavepoint();
         GSD_Partner__c newGSDP;

         try {
         
             //GSDP = (GSD_Partner__c) GSDDataUtility.getObject('GSD_Partner__c', GSDP.id);
             List<GSD_Partner__c> InsertGSDPList = new List<GSD_Partner__c>();
             List<GSD_Partner__c> GSDPList = [SELECT supervisor__c,Queue_Suffix__c,case_exchange_identifier__c,quota_factor__c,minimum_assignments_monthly__c,open_all_hours__c,account__c,country_iso__c,notes__c,portfolio__c,maximum_assignments_daily__c,createdbyid,lastmodifieddate,id,phone__c,portal_user_identifier__c,last_daily_counter_reset__c,logistics_badge_id__c,name,isdeleted,queue__c,resource__c,systemmodstamp,provider_type__c,last_monthly_counter_reset__c,does_diagnosis__c,email__c,send_case_exchange_reminders__c,mru_code__c,createddate,can_see_quotes__c,ownerid,assignment_counter_daily__c,country_name__c,active__c,case_exchange_enabled__c,assignment_counter_monthly__c,does_own_logistics_and_parts__c,engagement_method__c,maximum_assignments_monthly__c,lastmodifiedbyid,currencyisocode,commitment_levels__c FROM GSD_Partner__c WHERE Id = :GSDP.id];
             for(GSD_Partner__c GSDP : GSDPList ){
                 newGSDP = GSDP.clone(false);
                 newGSDP.Queue_Suffix__c = 'Enter Unique value';
                 InsertGSDPList.add(newGSDP);
             } 
             insert InsertGSDPList;

             if(!InsertGSDPList.isEmpty()){
                 newRecordId = InsertGSDPList[0].id;
             }
           
             GSD_Resource__c OldGSDResource = [select id from  GSD_Resource__c where Partner__c = :GSDP.id limit 1];
             OldGSDResourceId = OldGSDResource.id;
             system.debug('OldGSDResourceId :'+OldGSDResourceId );
             
             GSD_Resource__c NewGSDResource = [select id from  GSD_Resource__c where Partner__c = :newRecordId  limit 1];
             NewGSDResourceId = NewGSDResource.id;
             system.debug('NewGSDResourceId :'+NewGSDResourceId);
             
             CLoneGSDResourceLang();
             CLoneGSDResourceNon();
             CLoneGSDResourcePPS();
             CLoneGSDResourcePMaster();
             CLoneGSDResourceServices();
             CLoneGSDResourceTech();

         } catch (Exception e){
            Database.rollback(sp);
            ApexPages.addMessages(e);
            return null;
         }

        return new PageReference('/'+newGSDP.id+'/e?retURL=%2F'+newGSDP.id);
    }
    
    public void CLoneGSDResourceLang(){
    
        List<GSD_Resource_Skills_mapping__c> InsertnewSkillList = new List<GSD_Resource_Skills_mapping__c>();
        List<GSD_Resource_Skills_mapping__c> SkillsList = [select id,Skill_Name__c,Skill_Category__c,Standard__c,Stand_By__c,Non_Product_Skill_Level__c,Web_App_Resp_Created_Dt__c,Web_App_Resp_Modified_Dt__c,Responsibility_Skill_Level__c,Web_App_Employee_Id__c,Web_App_ID__c,Web_App_Skill_Id__c from GSD_Resource_Skills_mapping__c where Skill_Category__c = :Label.GSDResourceLang and Resource_ID__c = :OldGSDResourceId];  
        if(!SkillsList.isEmpty()){
            for (GSD_Resource_Skills_mapping__c GSDrskill : SkillsList) {
                  GSD_Resource_Skills_mapping__c newGSDrskill  = GSDrskill.clone(false);
                  newGSDrskill.Resource_ID__c = NewGSDResourceId;
                  InsertnewSkillList.add(newGSDrskill);
            }
            system.debug('InsertnewSkillList:'+InsertnewSkillList);
            insert InsertnewSkillList ;
        }
    }
    
    public void CLoneGSDResourceNon(){
    
        List<GSD_Resource_Skills_mapping__c> InsertnewSkillList = new List<GSD_Resource_Skills_mapping__c>();
        List<GSD_Resource_Skills_mapping__c> SkillsList = [select id,Skill_Name__c,Skill_Category__c,Standard__c,Stand_By__c,Non_Product_Skill_Level__c,Web_App_Resp_Created_Dt__c,Web_App_Resp_Modified_Dt__c,Responsibility_Skill_Level__c,Web_App_Employee_Id__c,Web_App_ID__c,Web_App_Skill_Id__c from GSD_Resource_Skills_mapping__c where Skill_Category__c = :Label.GSDResourceNon and Resource_ID__c = :OldGSDResourceId];  
        if(!SkillsList.isEmpty()){
            for (GSD_Resource_Skills_mapping__c GSDrskill : SkillsList) {
                  GSD_Resource_Skills_mapping__c newGSDrskill  = GSDrskill.clone(false);
                  newGSDrskill.Resource_ID__c = NewGSDResourceId;
                  InsertnewSkillList.add(newGSDrskill);
            }
            system.debug('InsertnewSkillList:'+InsertnewSkillList);
            insert InsertnewSkillList ;
        }
    }
    
    public void CLoneGSDResourcePPS(){
    
        List<GSD_Resource_Skills_mapping__c> InsertnewSkillList = new List<GSD_Resource_Skills_mapping__c>();
        List<GSD_Resource_Skills_mapping__c> SkillsList = [select id,Skill_Name__c,Skill_Category__c,Standard__c,Stand_By__c,Non_Product_Skill_Level__c,Web_App_Resp_Created_Dt__c,Web_App_Resp_Modified_Dt__c,Responsibility_Skill_Level__c,Web_App_Employee_Id__c,Web_App_ID__c,Web_App_Skill_Id__c from GSD_Resource_Skills_mapping__c where Skill_Category__c = :Label.GSDResourcePPS and Resource_ID__c = :OldGSDResourceId];  
        if(!SkillsList.isEmpty()){
            for (GSD_Resource_Skills_mapping__c GSDrskill : SkillsList) {
                  GSD_Resource_Skills_mapping__c newGSDrskill  = GSDrskill.clone(false);
                  newGSDrskill.Resource_ID__c = NewGSDResourceId;
                  InsertnewSkillList.add(newGSDrskill);
            }
            system.debug('InsertnewSkillList:'+InsertnewSkillList);
            insert InsertnewSkillList ;
        }
    }
    
    public void CLoneGSDResourcePMaster(){
    
        List<GSD_Resource_Skills_mapping__c> InsertnewSkillList = new List<GSD_Resource_Skills_mapping__c>();
        List<GSD_Resource_Skills_mapping__c> SkillsList = [SELECT Id, Name, Skill_Name__r.Name, Responsibility_Skill_Level__c, Skill_Name__r.Product_Description__c, Skill_Name__r.Portfolio__c FROM GSD_Resource_Skills_mapping__c WHERE Resource_ID__c = :OldGSDResourceId AND Skill_Category__c =: Label.GSDResourcePMaster ];
        if(!SkillsList.isEmpty()){
            for (GSD_Resource_Skills_mapping__c GSDrskill : SkillsList) {
                  GSD_Resource_Skills_mapping__c newGSDrskill  = GSDrskill.clone(false);
                  newGSDrskill.Resource_ID__c = NewGSDResourceId;
                  InsertnewSkillList.add(newGSDrskill);
            }
            system.debug('InsertnewSkillList:'+InsertnewSkillList);
            insert InsertnewSkillList ;
        }
    }
    
    public void CLoneGSDResourceServices(){
    
        List<GSD_Resource_Skills_mapping__c> InsertnewSkillList = new List<GSD_Resource_Skills_mapping__c>();
        List<GSD_Resource_Skills_mapping__c> SkillsList = [SELECT Id, Name, Skill_Name__r.Name, Responsibility_Skill_Level__c, Skill_Name__r.Product_Description__c, Skill_Name__r.Portfolio__c, Skill_Name__r.Support_Activity__c,Standard__c, Stand_By__c FROM GSD_Resource_Skills_mapping__c WHERE Resource_ID__c = :OldGSDResourceId AND Skill_Category__c ='Services' ];
        if(!SkillsList.isEmpty()){
            for (GSD_Resource_Skills_mapping__c GSDrskill : SkillsList) {
                  GSD_Resource_Skills_mapping__c newGSDrskill  = GSDrskill.clone(false);
                  newGSDrskill.Resource_ID__c = NewGSDResourceId;
                  InsertnewSkillList.add(newGSDrskill);
            }
            system.debug('InsertnewSkillList:'+InsertnewSkillList);
            insert InsertnewSkillList ;
        }
    }
    
    public void CLoneGSDResourceTech(){
    
        List<GSD_Resource_Skills_mapping__c> InsertnewSkillList = new List<GSD_Resource_Skills_mapping__c>();
        List<GSD_Resource_Skills_mapping__c> SkillsList = [SELECT Id, Name, Responsibility_Skill_Level__c, Skill_Name__r.Name, Skill_Name__r.Technologies_Name__c FROM GSD_Resource_Skills_mapping__c WHERE Resource_ID__c =:OldGSDResourceId  AND Skill_Category__c =: Label.GSDResourceTech ];
        if(!SkillsList.isEmpty()){
            for (GSD_Resource_Skills_mapping__c GSDrskill : SkillsList) {
                  GSD_Resource_Skills_mapping__c newGSDrskill  = GSDrskill.clone(false);
                  newGSDrskill.Resource_ID__c = NewGSDResourceId;
                  InsertnewSkillList.add(newGSDrskill);
            }
            system.debug('InsertnewSkillList:'+InsertnewSkillList);
            insert InsertnewSkillList ;
        }
    }
}


test class:

@isTest
public class GSDPartnerCloneWithSkillsController_Test{

    private testMethod static void TestMethod1(){
    
        Global_Config__c GCObj=new Global_Config__c (CPQ_Mute_Validation_Rule__c=false,DPlus_Mute_Validation_Rule__c=true,Mute_Triggers__c=true,
                                                        Mute_Validation_Rule__c=true,Mute_Workflow_Rule__c=true,Name='GSD');
      
        insert GCOBJ;
        
                
        HPTriggerFrameworkObjectMapping__c PartCSObj= new HPTriggerFrameworkObjectMapping__c(name='GSD_Partner__c',DispatcherCalssName__c='GSDPartnerProfile');
        insert PartCSObj;
        
        HPTriggerFrameworkObjectMapping__c ResCSObj= new HPTriggerFrameworkObjectMapping__c(name='GSD_Resource__c',DispatcherCalssName__c='GSDNewResource');
        insert ResCSObj;
        
        HPTriggerFrameworkObjectMapping__c SKMObj= new HPTriggerFrameworkObjectMapping__c(name='GSD_Skill_Master__c',DispatcherCalssName__c='GSDSKillMaster');
        insert SKMObj;
        
        HPTriggerFrameworkObjectMapping__c RSKMMObj= new HPTriggerFrameworkObjectMapping__c(name='GSD_Resource_Skills_mapping__c',DispatcherCalssName__c='GSDResourceSkillMapping');
        insert RSKMMObj;
        
        Profile fsmManagerPro= [Select Id, Name from Profile where Name = 'GSD FSM Sub Regional Resource' limit 1];        
        
        User fsmProfileUser= new User( profileId = fsmManagerPro.id, username = 'testemail22@hp.com', email = 'testemail22@hp.com', 
                    emailencodingkey = 'UTF-8', localesidkey = 'en_US',languagelocalekey = 'en_US', timezonesidkey = 'America/Los_Angeles',
                    alias='cspu22', lastname='lastname', Adoption_Role_Type__c = 'IT', Email_Address__c = 'testemail3@hp.com',Legacy_Employee_Ref__c='12345', 
                    RMR_Primary_Operational_Role__c = 'Solution Architect');
        
        insert fsmProfileUser;
        
        World_Region__c WR=new World_Region__c();
        wr.Name='US';
        insert WR;
        
        
        
        RecordType rt = [select id,Name from RecordType where SobjectType='Account' and Name='Partner' Limit 1];
        account aObj=new account(name='Account1',RecordTypeId=rt.id,MDCP_Business_Relationship_ID__c = 'abc',World_Region1__c=wr.id);
        insert aObj;
        
        PageReference pref = Page.GSDpartnerClone;
        Test.setCurrentPage(pref);
        
        Gsd_partner__c pObj=new Gsd_partner__c(name='partnerEx1',Account__c = aObj.id,Phone__c='9739',Email__c='xyz@hp.com',Queue_Suffix__c='queue1');
        insert pObj;
        
        Apexpages.StandardController sc = new Apexpages.standardController(pObj);
        GSDPartnerCloneWithSkillsController PCObj=new GSDPartnerCloneWithSkillsController(sc);
        
        Test.startTest();
        
        GSD_Resource__c oldresource = [Select Id From GSD_Resource__c  where Partner__c = :pObj.id];
        system.debug('oldresource :'+oldresource);
        
        GSD_Skill_Master__c SMObj= new GSD_Skill_Master__c();
        SMObj.Skill_Name__c = 'testskillname';
        SMObj.Skill_Type__c='Non-Product';
        SMObj.Skill_Category__c='Language';
        SMObj.Name='German';
        insert SMObj;
        
        GSD_Resource_Skills_mapping__c RSMObj = new GSD_Resource_Skills_mapping__c();
        RSMObj.Skill_Name__c=SMObj.id;
        RSMObj.Standard__c=true;
        RSMObj.Stand_By__c=true;
        RSMObj.Non_Product_Skill_Level__c='0';
        RSMObj.Responsibility_Skill_Level__c='3';
        RSMObj.Skill_Category__c='Language';
        RSMObj.Resource_ID__c= oldresource.id;
        system.debug('RSMObj :'+RSMObj);
        insert RSMObj;
        
        PageReference ref = PCObj.cloneWithItems();
        
        
        PageReference redir = new PageReference('/'+PCObj.newRecordId+'/e?retURL=%2F'+PCObj.newRecordId);
        System.assertEquals(ref.getUrl(),redir.getUrl());
        
        List<GSD_Resource__c > newItems = [Select Id From GSD_Resource__c  where Partner__c = :PCObj.newRecordId];
        System.assertEquals(newItems.size(),1);
        
        List<GSD_Partner_Profile_Linkage__c> newItems1 = [Select Id From GSD_Partner_Profile_Linkage__c  where Accessible_To__c = :PCObj.newRecordId];
        System.assertEquals(newItems1.size(),1);
        
        Test.stopTest();
        

    }
    
}
Hi,

I have a created a Apex class as follows.

@RestResource(urlMapping='/showAccounts/*')
global class KarunaRESTController1
{

@HttpGet
global static LIST<Account> getAccounts()
{
List<Account> lst;
try
{

RestRequest req = RestContext.request;
String NameValue = req.params.get('name');
lst = [select name, AccountSource from Account where name=:NameValue LIMIT 100];
}
catch(Exception e)
{
system.debug('ERROR:'+e.getMessage());
}
return lst;
}
}


After successfully saving the class, when I try to invoke the url in the chorme- Rest Client, I am alwasy getting the Invalid session ID, even I pass the valid session. can you please share me how can I access my custom api.

https://na17.salesforce.com/services/apexrest/showAccounts

by passing authorization header as oauth. tried with oauth / bearer. none of them working.

Hi,

 

How to write a test class method for Page Refrence method in apex class,

 

i am trying to to write a test class method , but this test class method shows error

below is the error .

 

System.QueryException: List has no rows for assignment to SObject

 


Please

please help me ,

 

Thanks in Advance

 

  • January 24, 2013
  • Like
  • 0

Hi All,

 

I need to create hundreds of custom labels.

 

I have these labels in properties file as below.

UserName=User Name

Password=Password

 

Can we create them using apex code or we need to create them one by one from App Setup -> Custom Labels -> New Custom Label ?

 

Could anyone please help me on this

 

Thanks.

Hi,

 

I'm just using the XMLStreamWriter to generate an XML String which I am then passing to a web service. I need to generate a string that starts:

 

 

<?xml version="1.0" standalone="no"?>
<!DOCTYPE PRICEREQUEST SYSTEM  \'http://164.39.41.88:81/PriceCheckerDTD1.0/PriceRequestIN.dtd\'>

So far I have:

 

 

XmlStreamWriter w = new XmlStreamWriter();
w.writeStartDocument(null, '1.0');

But I can't see anyway of adding the standalone attribute to the document start or the DOCTYPE tag to the next line.

 

Does anyone know how this can be achieved using the XMLStreamWriter?

 

Cheers

 

James

 

 

 

Hi all,

 

Does anyone know how I can specify a PageReference to take the user to the homepage? I know I can use:

 

 

return new PageReference('/home');

 

 

but I don't know if this is very extensible. Does anyone know the official, Salesforce way of doing this?

 

Cheers

 

James

Hi all,

 

Does anyone know what the Organisation Wide callout limit is per day?

 

I can only find the bit that says 10 per transaction but not the maximum calls per day.

 

Cheers

 

James

Hi all,

 

Is it possible to setup an email to be sent to a user when they are given access to a record via a manual sharing rule?

 

Cheers

 

James

Hi all,

 

Does anyone know how I can prevent users from being able to delete notes? The users still need to be able to create Notes but for traceability we need to prevent users deleting notes...

 

Any help would be great,

 

Cheers

 

James

Hi all,

 

I am just creating a new Note within an Apex method, does anyone know how I can add a new line to the text? I have tried all the standard escape characters but none of them seem to work...

 

Cheers

 

James

Hi all,

 

I am having some issues when attempting to create a user for the customer portal. I am running on a sandbox org and have created the portal. I have added the Enable Customer Portal User button to the contact page layout but when I view a Contact this button does not appear. I am logged in as an administrator. I had a similar problem with the "Allow Customer Portal Self-Registration" field but after changing the field level security settings I could see the field. Does anyone have an clues as to why the button would not appear on the page layout?

 

Thanks

 

James 

 

Hi,

 

Is there any way within Salesforce Sites to get the domain name to appear as my main domain name but still have a path to each separate page (i.e. not using an iFrame)?

 

Thanks

 

James 

Hi all,

 

I am currently trying to create a new VisualForce page that handles the creation of Accounts and Contacts. I have got the field "Parent Account" which I display by using:

 

 

<apex:inputField value="{!account.Parent}" required="true"/>

 

behind this is the Apex code:

 

 

public Account account { get { return accAccount; } set { accAccount = value; } }

 

 for some reason when I try to save the Account by using:

 

upsert accAccount;

 

 I get the error:

 

 

Error: j_id0:j_id1:j_id3:j_id4:j_id13:j_id16: An error occurred when processing your submitted information.

 

 appear next to the Parent Account field. Does anyone know what might cause this error and how it could be resolved?

 

Thanks

 

James 

 

 

 

 

Hi,

I notice this weird behaviour of SFDC when it displays number on a VisualForce page.

 

 

 When the value is "15,000,000", the value displayed is "1.5E+7"

 

 But when I modify the last digit of the value to "15,000,001", it displays correctly as "15000001"

 

 

Is this a SFDC defect?

Hi all,

 

Is there any way of making a commandbutton run some apex code but not refresh on button click?

 

Cheers

 

James