• RadDude89
  • NEWBIE
  • 110 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 31
    Questions
  • 26
    Replies

Hi,

I am trying to use the pattern.matches function on an apex trigger on our sandbox, what we are trying to do is update a record to Pending Validation based on whether a linked record meets the format required.

So on the trigger we have:

 

trigger Enrg_PendingValidation_Trigger on Registrations__c (Before Update, Before Insert){
for(Registrations__c reg:trigger.new){

Boolean validTelephone;
telephonePat='[0-9]{3} [0-9]{4} [0-9]{4}';

telephone = reg.Site__r.Site_Phone__c;
validTelephone= Pattern.matches(telephonePat,telephone);

if(reg.Site__r.Site_Phone__c != null && validTelephone!= true ){
               reg.Registration_Status__c='Pending Validation';                                   
               }
}
}

This trigger saves ok on Salesforce but when I try to edit and save the registration I get the error message
Script-thrown exception: Class.System.Pattern.matcher

It appears that the issue is being caused by the line validTelephone= Pattern.matches(telephonePat,telephone); as when I comment this out I am able to save the record.

Can anyone help me on this?  I can't see what I am doing wrong here.

Thanks in advance.

Hi,

We appear to be having an issue on our Salesforce portal - it looks like when we attempt to register a customer as 'Renewal' there is no record type assigned to the record.  So when we press the save button we get an error message saying about a Bad Value for Record Type with the ID being null.

In order to resolve this issue I want to add a condition so that if the user selects Renewal then to apply a particular record type or if the recordtypeID is blank then apply a record type.

Does anyone know how to do this?

I've tried some code but when I do I get the attempt to de-reference a null object error on the visualforce page.

This is what I have currently in the apex class which is causing the issue.

if(regObj.RecordTypeID==null){                 
regObj.RecordTypeID = recmap1.get('Partner MPRN ROI');

I've also tried the code below but same results:

if(regObj.RecordTypeID==null){                    
                    regObj.RecordTypeID=Schema.SObjectType.site__c.getRecordTypeInfosByName().get('Partner MPRN ROI').getRecordTypeId();
                }

Is there something I'm doing wrong?

Thanks in advance.

 

Hi,

We use an apex class and visualforce page for calculate which users can select which pricebooks (custom object).
Within the logic I can see that Userinfo will has been added - so this looks like it will only return pricebooks for standard license users (I think I'm correct in saying this).

What I want to do within this selection query is return the pricebooks which have the same value on User field and the same value on the current users custom field Agent.
E.g. Pricebook.User__c = User.Agent_Name__c.

Below is the current code:
if(Userinfo.getUserType() == 'Standard'){           
            priceBookList = [select Product__c,name,id, name,Description__c,Contract_Start_Date__c, Internal__c from 
            Pricebook__c where Product__c=:selectedProduct and Active__c = True];

Does anyone know how I can add this in?
Anything I seem to try doesn't work.

Thanks in advance

Hi,

I'm looking into creating a process in which Salesforce will update the parent record if a field on the child has the value 'Rejected'.

So we have a parent object - Offer and child - Offer SIte.
Then if the field Status__c on Offer Site = 'Rejected', I want to apply the same value to a field called Status on Offer automatically once the field on Offer site is updated.

Does anyone know how to do this?
I'm not too sure on how I can write this into trigger as my experience with triggers is basic

Any help is much appreciated.
Thanks.

Hi,

We have added additional logic to an aex class on our Salesforce - the logic is applied to a custom object called Registration__c.

When you create a registration, the system will go through a number of conditions and will create a record called Credit - only if sertian criteria is met.
When we test this on our sandboxes, it works perfectly but when we attempt to register a site on production:
"Insert failed. First exception on row 0; first error: TOO_MANY_ENUM_VALUE, Credit Risk Reason: too many items selected: 18517 [Credit_Risk_Reason__c}"

Below is the code which causes the issue:
    listregQry2=[Select High_Risk_Email__c, High_Risk_Phone_Number__c from High_Risk__c]                           
                if(listregQry!=null){
                    for(Registrations__c r:listregQry){
                        String CreditComReason='';
                        if(sitenames==null||!sitenames.contains(r.site__r.name)){
                            Credit_Committee__c CCobj = new Credit_Committee__c(status__c='Referred');
                            CCobj.Comments_For_Credit_Committee__c=r.Comments_For_Credit_Committee__c;
                            sitenames.add(r.site__r.name);
                            if(listregQry2!=null){                               
                                for(Bad_Debt_Data__c r1:listregQry2){                                                                      
                                    if(r1.High_Risk_Email__c == r.site__r.contact__r.email)  {                                     
                                        System.debug('high risk email');
                                        CreditComReason=CreditComReason+'High Risk Email Found;';
                                    }
                                }
                               
                                if(r.site__r.contact__r.Phone != NULL){
                                    for(Bad_Debt_Data__c r2:listregQry2){
                            if(r2.High_Risk_Phone_Number__c == r.site__r.contact__r.Phone){ 
                                System.debug('high risk contact');
                                CreditComReason=CreditComReason+'High Risk Phone Number Found;';
                            }
                            }
                            }
                        }

Does anyone know what is causing this issue? Any ideas on how to resolve?

Any help is much appreciated.

Regards,
RadDude89

Hi,

I'm writing a small apex class test for a trigger we have but when I run the test it fails with the error message "Missing id at index".

This is the test class below.

@istest
public class DeleteJunk_trigger_test {

    public static testmethod void DeleteJunk_trigger()
    {
       test.startTest();
         Registrations__c reg = new Registrations__c(GPRN__c = '',  Source__c = '' , Source_System__c = '' , Region__c = '' ,     
        MPRN__c = '');
       delete reg;
       }
       }

Can anyone see what I am missing?

Thanks.

Hi,

We have created an apex class and 2 triggers which execute once a registration record is created/updated in order to update the record based on certain criteria.
From this we have noticed that in the mornings the registration process can be quite slow for some users and in some cases they will get the request timed out error message.
When a system admin tries it, sometimes its slow but most of the time we can create the registration fairly quickly.

Is there anything that I should check to maybe increase the request time of the users/triggers? I've never got an error like this and we never had the error in any of our sandboxes - it just appears to be production.
Does anyone know how to resolve this/had a similiar problem?

Thanks.

Hi,

I'm trying to return values from a list in an apex class using the value from another list.
So I have list1 = [Select Contact__r.ContactEmail from Registrations__c Id in : lstRegistrations]

and what I want to do is check all the records from another object using the value of ContactEmail from above list.
So something like this:
list2=[Select Email from Site__c where Email contains (list1.Contact__r.ContactEmail)]

Can this be done?

Any help is much appreciated.

Thanks

Hi,

We are trying to add logic into our apex class where if the user registers a site and the mobile phone value held at contact is found on any other contact records it will update a field on registration.

So below I have these 2 lists.

listregQry= this contains the mobilephone from the contact being registered.
listregMobile= this contains all Mobile Phone values from our system

listregQry=[Select site__r.Contact__r.MobilePhone from Registrations__c where Id in : lstRegistrations ];
listregMobile=[Select Contact__r.MobilePhone from Site__c];

What I want to do is update a field called Mobile Used to TRUE when the Mobile Phone from listregQry is found on the system on a different contact record.

Does anyone know how I can achieve this?


Thanks in advance.

Hi,

I'm wondering if it is possible to create a dynamic lookup on a visualforce page in Salesforce.  We want to be able to allow the user to start typing into a field and it will return site names based on what the user typed.

For example - typing 'T' into Company name would show a drop down of sites beginning with T.  Then if the user added 'e' it would show the sites beginning with Te.

Is this posible to achieve on Salesforce?

Thanks.

Hey guys,

We have an apex class and VF page called Register.  On this page the user can select from 4 different values on a picklist field called Type.

Is it possible to show all fours selections to all users that have Agent (checkbox) as TRUE on their user profile?

So what I would need is any currently logged in user with Agent as TRUE will see Options 1,2,3,4 and any user with Agent as FALSE will see options 1,2,3.

Can this be done?

Hi,

We have set up an approval process called Renew.  This approval process was created via the standard process (adding email alerts, approval/rejection field updates, etc). When we create an offer record the approval process doesn't start - the user must press submit for approval.  Can you create an apex trigger to initiate an approval process when a record has been created?
So in a way we would be pressing the submit for approval for the user automatically.
Can the trigger call on the ID of the approval process to initiate it if certain requirements are met?

Hi,

I have created an approval process for a custom object called Offer which is based on several selections regarding the creation of the offer.
The offer is to be locked and sent to a manager for approval when the criteria is
Price <0.200 and Region= NI
What I have realised is that when the offer is created the approval won't start - the user has to press the Submit for Approval for it to start.

Is it possible to create a trigger to kick the approval process off automatically when the offer has been created?

Hi,

I'm trying to introduce validation on one of our apex classes which is based on a custom field value on the user's record.

So we have a custom field setup on the user object called Consultant (checkbox).
When a user logs in I want to return an error message if that current logged in user has Consultant = FALSE then show them the error message whereas for users where Consultant = TRUE they can bypass the error.

List<User> lstUser = [Select Agent_Name__c from User where userinfo.Consultant__c=TRUE];
 if(lstUser.size()==0 ){
                                apexpages.addmessage(new ApexPages.Message(ApexPages.severity.FATAL,' You can not proceed'));

When I try using userinfo. it doesn't compile so does anyone know how to retrieve a value from a custom field on user object for the current user?

Hi,

I'm trying to create a validation rule that looks at a picklist field and return an error if the value has been changed after the record is approved.

The field contains 4 selections: 14, 30, 45 and 60.

What I'm trying to achieve is a validation rule that if a user (originally created the record with 14 as the selection) was to change it to 30, then they would get an error message "you can not change after approval".

When I try using the priorvalue, it says that this function can not be used in this type of formula.
I tried changing it to use TEXT values i.e.
(TEXT(Payment_Date__c) != TEXT(PRIORVALUE(Payment_Date__c)))

However this doesn't return the error message even I'm able to save the validation rule.

Does anyone know how to achieve using priorvalue for picklists? What is the best method for this?

Hi,

Is it possible to update a dependent picklist based on the selection of the controlling picklist?
For example - we have a list of countries on a controlling picklist and a dependent picklist of the abbreviated versions of the countries.
So if a user selected "England" then "Eng" would be available to select but the user would have to manually select it.

Can a visualforce page be changed so that if a user selected "England" then "Eng" would be automatically be selected on the dependent picklist rather the user having to select it?

Thanks in advance.

Hi,
I'm creating 2 columns on one of our visualforce pages and I am able to seperate the fields into 2 columns but whenever I get this happening the field labels are removed.  The visualforce page only shows the actual input text fields but not the labels.
Below is my code on the VF page:


<apex:pageBlockSection columns="2">
            <apex:pageblock title="Account Information">
                <apex:inputField label="Lead Status" value="{!newLead.Status}" required="true" /> <br> </br>
                <apex:inputField label="Fuel Type" value="{!newLead.Fuel_Type__c}" /> <br> </br>
                <apex:inputField label="Region" value="{!newLead.Region__c}" /> <br> </br>
                <apex:outputField value="{!newLead.RecordTypeId}" /> <br> </br>
                </apex:pageblock>
                <apex:pageblock title="Account Information 2">
                <apex:inputField value="{!newLead.Consumption__c}" /> <br> </br>
                <apex:inputField value="{!newLead.Dual_Fuel__c}" /> <br> </br>
                <apex:inputField value="{!newLead.Associated_Dual_Fuel_Site__c}" /> <br> </br>
                <apex:inputField value="{!newLead.Qualification_Check__c}" /> <br> </br>
                </apex:pageBlock>
            </apex:pageBlockSection>


Am I doing something wrong here?  Does anyone know how I can get the labels to appear?
Any help is much appreciated

Hi,

I'm trying to change our visualforce page so that it is seperated into 2 columns with a header above each column.
However we I check the page the section headers are on the left side and the field labels appears to be missing too.

Below is the visualforce code:

   <apex:pageBlockSection columns="2">
            <div class="brandTertiaryBgr pbSubheader tertiaryPalette" id="head_1_ep">
                <span class="pbSubExtra">
                    <span class="requiredLegend brandTertiaryFgr">
                        <span class="requiredExampleOuter">
                            <span class="requiredExample"></span>
                        </span>
                        <span class="requiredMark">*</span>&nbsp;
                        <span class="requiredText">= Required Information</span>
                    </span>
                </span>
                <h3>Account Information<span  class="titleSeparatingColon">:</span></h3>
            </div>
            <apex:pageblocksectionitem >
            <apex:outputLabel value="Column 1"/>
            <apex:outputPanel layout="block">
                <apex:outputText label="Lead Owner" value="{!currentUserName}" />
                <apex:inputField label="Lead Source" value="{!newLead.LeadSource}" />
                <apex:inputField label="Lead Status" value="{!newLead.Status}" required="true" />
                <apex:inputField label="Fuel Type" value="{!newLead.Fuel_Type__c}" />
                <apex:inputField label="Region" value="{!newLead.Region__c}" />
                <apex:outputField value="{!newLead.RecordTypeId}" />
                </apex:outputPanel>
                </apex:pageblocksectionitem>
                  <div class="brandTertiaryBgr pbSubheader tertiaryPalette" id="head_1_ep">
                <span class="pbSubExtra">
                    <span class="requiredLegend brandTertiaryFgr">
                        <span class="requiredExampleOuter">
                            <span class="requiredExample"></span>
                        </span>
                        <span class="requiredMark">*</span>&nbsp;
                        <span class="requiredText">= Required Information</span>
                    </span>
                </span>
                <h3>Account Information<span  class="titleSeparatingColon">:</span></h3>
            </div>
                <apex:pageblocksectionItem >
                <apex:outputLabel value="Column 2"/>
                <apex:outputPanel layout="block">
                <apex:inputField value="{!newLead.Consumption__c}" />
                <apex:inputField value="{!newLead.Dual_Fuel__c}" />
              <!--  <apex:inputField value="{!newLead.Eligibility_for_QH_Metering__c}" /> -->
                <apex:inputField value="{!newLead.Associated_Dual_Fuel_Site__c}" />
                <apex:inputField value="{!newLead.Qualification_Check__c}" />
                <apex:inputField value="{!newLead.GMPRN__c}" />
               <!-- <apex:inputField value="{!newLead.Burn_Hour_Calender__c}" /> -->
                <apex:inputField value="{!newLead.Electricity_Tax__c}" />               
                <apex:inputField value="{!newLead.Government_Non_Government__c}" required="true" />
                </apex:outputPanel>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>

Can anyone see what I am doing wrong here?  Is it posible to have a heading on each column with the field names appearing?User-added image

Any help is much appreciated.

Thanks in advance

Hi,

We have an apex class on our organistaion that has a code coverage of 88% (23/26).  The class itself is only 37 lines and the test class is 25 lines.

Apex Class:

public class Enrg_MeterOfferTag_ACL{
    public static integer rec=0;
    public static void taggOS(Set<Id> setOS, Map<Id,Id> mapOS){
        if(rec==0){
            List<Offer_Site__c> listOS=new List<Offer_Site__c>();
            List<Offer_Site__c> updOs=new List<Offer_site__c>();
            listOS=[Select id,Meter_Provided__c,Meter_Read__c from Offer_Site__c where Id in :setOS];
            for(Offer_site__c objOS:listOS){
                if(objOS.Meter_Read__c==null && mapOS.ContainsKey(objOS.Id)){
                    objOS.Meter_Provided__c=true;
                    objOS.Meter_Read__c=mapOS.get(objOS.Id);
                    updOS.add(objOS);
                }
            }
            if(updOS.Size()>0)
                update updOS;
            rec++;   
        }
    }
     public static void taggRej(Set<String> setreg, Map<String,ID> mapreg){
        if(rec==0){
            List<Registrations__c> listreg=new List<Registrations__c>();
            List<Registrations__c> updreg=new List<Registrations__c>();
            listreg=[Select id,Meter_Read_Information__c from Registrations__c where Id in :setreg];
            for(Registrations__c objreg:listreg){
                System.debug(objreg.Id);
                if(mapreg.ContainsKey(String.valueof(objreg.Id).substring(0,15))){
                    objreg.Meter_Read_Information__c=mapreg.get(String.valueof(objreg.Id).substring(0,15));
                    updreg.add(objreg);
                }
            }
            if(updreg.Size()>0)
                update updreg;
            rec++;   
        }
    }
}

 

Apex Class Test:

@isTest
private class Enrg_MeterOfferTag_ACL_Test {
private static integer rec=0;
    static testMethod void Enrg_MeterOfferTag_ACL_Test_testmethod() {
        offer__c off=new offer__c();
        insert off;
        Offer_Site__c offsite1=new Offer_Site__c(name='offersite1',offer__c=off.id,MPRN__c='23652013036', Meter_Provided__c=true);
        insert offsite1;       
        Meter_Read__c meter1=new Meter_Read__c(Offer_Site_Id__c=offsite1.id,MPRN__c='23652013036');
        insert meter1;
       
    }
    static testMethod void Enrg_MeterOfferTag_ACL_Test_testmethod1() {
       
        offer__c off1=new offer__c();
        insert off1;
        Offer_Site__c offsite2=new Offer_Site__c(name='offersite2',offer__c=off1.id,MPRN__c='23652013036');
        insert offsite2;
        Registrations__c reg=new Registrations__c() ;
        insert reg;    
        Meter_Read__c meter2=new Meter_Read__c(registration__c=reg.id);
        insert meter2;
        //update reg;
    }
}

 

Does anyone know what I could add in order to have the code coverage as 100% (26/26)?
Any help is much appreciated.

Thanks

Hi,

I am trying to deploy some code from a sandbox to production but I'm getting the error message that my companys code coverage is 74%.

When I check one of the apex classes in my change set - it has the code coverage of 44% but it doesn't have any test class associated with it.
Is it possible to increase this code coverage for the apex class without creating a test class (this deployment has been the only one to return the error)? Can I add something into the class so that I could increase the coverage to 55% - does commenting count or using system.debug?

Hi,

We updated our data loader from version 20 to 34 yesterday and since we made the change a few of our batch jobs have stopped working - most of them are fine but 2 of the batch jobs (via windows batch file/command line) are receiving the error below.

FATAL [main] process.ProcessRunner topLevelError (ProcessRunner.java:238) - Unable to run process extractBillingAgentGas
java.lang.RuntimeException: java.lang.IllegalArgumentException: Cannot parse empty string
 at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:162)
 at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:100)
 at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:253)
Caused by: java.lang.IllegalArgumentException: Cannot parse empty string
 at com.salesforce.dataloader.mapping.SOQLInfo.getTrimmed(SOQLInfo.java:162)
 at com.salesforce.dataloader.mapping.SOQLInfo.access$000(SOQLInfo.java:38)
 at com.salesforce.dataloader.mapping.SOQLInfo$SOQLFieldInfo.<init>(SOQLInfo.java:52)
 at com.salesforce.dataloader.mapping.SOQLInfo$SOQLFieldInfo.<init>(SOQLInfo.java:72)
 at com.salesforce.dataloader.mapping.SOQLMapper.putPropertyEntry(SOQLMapper.java:99)
 at com.salesforce.dataloader.mapping.Mapper.putPropertyFileMappings(Mapper.java:139)
 at com.salesforce.dataloader.mapping.Mapper.putPropertyFileMappings(Mapper.java:134)
 at com.salesforce.dataloader.mapping.Mapper.<init>(Mapper.java:86)
 at com.salesforce.dataloader.mapping.SOQLMapper.<init>(SOQLMapper.java:58)
 at com.salesforce.dataloader.controller.Controller.createMapper(Controller.java:194)
 at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:146)

I don't know how to fix this and I can't seem to find much information on the error message - has anyone come across this issue before?
Can anyone know how to fix this error message?

Any help is much appreciated.

Hi,

We have visualforce pages in SF which contain 3 picklists, see code below.
<apex:inputField value="{!newLead.Site_County_1__c}" />

Something strange is happening for these fields, when a user has the field populated and then opens the record to edit and save. the values have disppeared when they save it again.

Has this happened to anyone before?

Hi,

I am trying to use the pattern.matches function on an apex trigger on our sandbox, what we are trying to do is update a record to Pending Validation based on whether a linked record meets the format required.

So on the trigger we have:

 

trigger Enrg_PendingValidation_Trigger on Registrations__c (Before Update, Before Insert){
for(Registrations__c reg:trigger.new){

Boolean validTelephone;
telephonePat='[0-9]{3} [0-9]{4} [0-9]{4}';

telephone = reg.Site__r.Site_Phone__c;
validTelephone= Pattern.matches(telephonePat,telephone);

if(reg.Site__r.Site_Phone__c != null && validTelephone!= true ){
               reg.Registration_Status__c='Pending Validation';                                   
               }
}
}

This trigger saves ok on Salesforce but when I try to edit and save the registration I get the error message
Script-thrown exception: Class.System.Pattern.matcher

It appears that the issue is being caused by the line validTelephone= Pattern.matches(telephonePat,telephone); as when I comment this out I am able to save the record.

Can anyone help me on this?  I can't see what I am doing wrong here.

Thanks in advance.

Hi,

We use an apex class and visualforce page for calculate which users can select which pricebooks (custom object).
Within the logic I can see that Userinfo will has been added - so this looks like it will only return pricebooks for standard license users (I think I'm correct in saying this).

What I want to do within this selection query is return the pricebooks which have the same value on User field and the same value on the current users custom field Agent.
E.g. Pricebook.User__c = User.Agent_Name__c.

Below is the current code:
if(Userinfo.getUserType() == 'Standard'){           
            priceBookList = [select Product__c,name,id, name,Description__c,Contract_Start_Date__c, Internal__c from 
            Pricebook__c where Product__c=:selectedProduct and Active__c = True];

Does anyone know how I can add this in?
Anything I seem to try doesn't work.

Thanks in advance

Hi,

I'm looking into creating a process in which Salesforce will update the parent record if a field on the child has the value 'Rejected'.

So we have a parent object - Offer and child - Offer SIte.
Then if the field Status__c on Offer Site = 'Rejected', I want to apply the same value to a field called Status on Offer automatically once the field on Offer site is updated.

Does anyone know how to do this?
I'm not too sure on how I can write this into trigger as my experience with triggers is basic

Any help is much appreciated.
Thanks.

Hi,

We have added additional logic to an aex class on our Salesforce - the logic is applied to a custom object called Registration__c.

When you create a registration, the system will go through a number of conditions and will create a record called Credit - only if sertian criteria is met.
When we test this on our sandboxes, it works perfectly but when we attempt to register a site on production:
"Insert failed. First exception on row 0; first error: TOO_MANY_ENUM_VALUE, Credit Risk Reason: too many items selected: 18517 [Credit_Risk_Reason__c}"

Below is the code which causes the issue:
    listregQry2=[Select High_Risk_Email__c, High_Risk_Phone_Number__c from High_Risk__c]                           
                if(listregQry!=null){
                    for(Registrations__c r:listregQry){
                        String CreditComReason='';
                        if(sitenames==null||!sitenames.contains(r.site__r.name)){
                            Credit_Committee__c CCobj = new Credit_Committee__c(status__c='Referred');
                            CCobj.Comments_For_Credit_Committee__c=r.Comments_For_Credit_Committee__c;
                            sitenames.add(r.site__r.name);
                            if(listregQry2!=null){                               
                                for(Bad_Debt_Data__c r1:listregQry2){                                                                      
                                    if(r1.High_Risk_Email__c == r.site__r.contact__r.email)  {                                     
                                        System.debug('high risk email');
                                        CreditComReason=CreditComReason+'High Risk Email Found;';
                                    }
                                }
                               
                                if(r.site__r.contact__r.Phone != NULL){
                                    for(Bad_Debt_Data__c r2:listregQry2){
                            if(r2.High_Risk_Phone_Number__c == r.site__r.contact__r.Phone){ 
                                System.debug('high risk contact');
                                CreditComReason=CreditComReason+'High Risk Phone Number Found;';
                            }
                            }
                            }
                        }

Does anyone know what is causing this issue? Any ideas on how to resolve?

Any help is much appreciated.

Regards,
RadDude89

Hi,

We have created an apex class and 2 triggers which execute once a registration record is created/updated in order to update the record based on certain criteria.
From this we have noticed that in the mornings the registration process can be quite slow for some users and in some cases they will get the request timed out error message.
When a system admin tries it, sometimes its slow but most of the time we can create the registration fairly quickly.

Is there anything that I should check to maybe increase the request time of the users/triggers? I've never got an error like this and we never had the error in any of our sandboxes - it just appears to be production.
Does anyone know how to resolve this/had a similiar problem?

Thanks.

Hi,

We are trying to add logic into our apex class where if the user registers a site and the mobile phone value held at contact is found on any other contact records it will update a field on registration.

So below I have these 2 lists.

listregQry= this contains the mobilephone from the contact being registered.
listregMobile= this contains all Mobile Phone values from our system

listregQry=[Select site__r.Contact__r.MobilePhone from Registrations__c where Id in : lstRegistrations ];
listregMobile=[Select Contact__r.MobilePhone from Site__c];

What I want to do is update a field called Mobile Used to TRUE when the Mobile Phone from listregQry is found on the system on a different contact record.

Does anyone know how I can achieve this?


Thanks in advance.

Hi,

We have set up an approval process called Renew.  This approval process was created via the standard process (adding email alerts, approval/rejection field updates, etc). When we create an offer record the approval process doesn't start - the user must press submit for approval.  Can you create an apex trigger to initiate an approval process when a record has been created?
So in a way we would be pressing the submit for approval for the user automatically.
Can the trigger call on the ID of the approval process to initiate it if certain requirements are met?

Hi,

I have created an approval process for a custom object called Offer which is based on several selections regarding the creation of the offer.
The offer is to be locked and sent to a manager for approval when the criteria is
Price <0.200 and Region= NI
What I have realised is that when the offer is created the approval won't start - the user has to press the Submit for Approval for it to start.

Is it possible to create a trigger to kick the approval process off automatically when the offer has been created?

Hi,

I'm trying to introduce validation on one of our apex classes which is based on a custom field value on the user's record.

So we have a custom field setup on the user object called Consultant (checkbox).
When a user logs in I want to return an error message if that current logged in user has Consultant = FALSE then show them the error message whereas for users where Consultant = TRUE they can bypass the error.

List<User> lstUser = [Select Agent_Name__c from User where userinfo.Consultant__c=TRUE];
 if(lstUser.size()==0 ){
                                apexpages.addmessage(new ApexPages.Message(ApexPages.severity.FATAL,' You can not proceed'));

When I try using userinfo. it doesn't compile so does anyone know how to retrieve a value from a custom field on user object for the current user?

Hi,

I'm trying to create a validation rule that looks at a picklist field and return an error if the value has been changed after the record is approved.

The field contains 4 selections: 14, 30, 45 and 60.

What I'm trying to achieve is a validation rule that if a user (originally created the record with 14 as the selection) was to change it to 30, then they would get an error message "you can not change after approval".

When I try using the priorvalue, it says that this function can not be used in this type of formula.
I tried changing it to use TEXT values i.e.
(TEXT(Payment_Date__c) != TEXT(PRIORVALUE(Payment_Date__c)))

However this doesn't return the error message even I'm able to save the validation rule.

Does anyone know how to achieve using priorvalue for picklists? What is the best method for this?

Hi,
I'm creating 2 columns on one of our visualforce pages and I am able to seperate the fields into 2 columns but whenever I get this happening the field labels are removed.  The visualforce page only shows the actual input text fields but not the labels.
Below is my code on the VF page:


<apex:pageBlockSection columns="2">
            <apex:pageblock title="Account Information">
                <apex:inputField label="Lead Status" value="{!newLead.Status}" required="true" /> <br> </br>
                <apex:inputField label="Fuel Type" value="{!newLead.Fuel_Type__c}" /> <br> </br>
                <apex:inputField label="Region" value="{!newLead.Region__c}" /> <br> </br>
                <apex:outputField value="{!newLead.RecordTypeId}" /> <br> </br>
                </apex:pageblock>
                <apex:pageblock title="Account Information 2">
                <apex:inputField value="{!newLead.Consumption__c}" /> <br> </br>
                <apex:inputField value="{!newLead.Dual_Fuel__c}" /> <br> </br>
                <apex:inputField value="{!newLead.Associated_Dual_Fuel_Site__c}" /> <br> </br>
                <apex:inputField value="{!newLead.Qualification_Check__c}" /> <br> </br>
                </apex:pageBlock>
            </apex:pageBlockSection>


Am I doing something wrong here?  Does anyone know how I can get the labels to appear?
Any help is much appreciated

Hi,

I'm adding validation to apex class in which if a user enters a value above or below a certain figure then a warning message should appear asking the user if they wish to proceed with their selection.

However the warning message doesn't appear when the criteria is met.

The message will appear however when the criteria on the statement above (an error message) is met first. So basically for my warning message to appear, the user would have to meet the critieria of the error message first.
If they don't, then the warning message doesn't and the user can't progress to the next stage.

I tried swapping the code so the warning message was above the error message on the script but then neither message appears when the criteria is met.

See below error message and warning message.
if(offernew.Print_on_Bill__c==false && offernew.Commission_Payable_Term__c=='Monthly'){
            showpageblock4=true;
            Apexpages.addmessage(new ApexPages.Message(ApexPages.severity.FATAL,'You must check Print on Bill if Commission Payable Term is monthly')); 
            return null;
        }
         if(offernew.Commission_Value__c>0.025 || offernew.Commission_Value__c<0.001){
            Apexpages.addmessage(new ApexPages.Message(ApexPages.severity.WARNING,'Do you want to proceed with this commission value?')); 
            return null;
        }     

Does anyone now how to make this warning message appear without having to get the error message first?
Any help is much appreciated.

Thanks.

Hi,

We updated data loader yesterday from version 20 to 34 and now one of our command line batch jobs has stopped working.  I'm unsure of the error message as I've never seen it before.

Error:

action.AbstractAction execute (AbstractAction.java:120) - Loading: upsert
2015-08-14 12:40:59,920 ERROR [upsertSiteElectricity] action.AbstractAction handleException (AbstractAction.java:204) - Exception occured during loading
java.lang.IndexOutOfBoundsException: Index: 5, Size: 5
 at java.util.ArrayList.RangeCheck(Unknown Source)
 at java.util.ArrayList.get(Unknown Source)
 at com.salesforce.dataloader.dao.csv.CSVFileReader.readRow(CSVFileReader.java:191)
 at com.salesforce.dataloader.util.DAORowUtil.calculateTotalRows(DAORowUtil.java:67)
 at com.salesforce.dataloader.dao.csv.CSVFileReader.getTotalRows(CSVFileReader.java:218)
 at com.salesforce.dataloader.action.AbstractLoadAction.initOperation(AbstractLoadAction.java:100)
 at com.salesforce.dataloader.action.AbstractAction.execute(AbstractAction.java:122)
 at com.salesforce.dataloader.controller.Controller.executeAction(Controller.java:121)
 at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:149)
 at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:100)
 at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:253)
2015-08-14 12:40:59,920 ERROR [upsertSiteElectricity] progress.NihilistProgressAdapter doneError (NihilistProgressAdapter.java:58) - Index: 5, Size: 5

Does anyone know how to resolve this?

Any help is much appreciated.

Hi,

I'm adding a field from a parent object on one of our apex classes and one the corresponding visualforce page. When I am navigating to the visualforce page I checked the error message "System.NullPointerException: Attempt to de-reference a null object".

The error seems to be coming from line 620 on the apex class -
offerSiteObj.Offer__r.End_Date__c = offerSiteList[0].Offer__r.End_Date__c;
But I can't see whats wrong with this - this is to allow the user to enter a value and then when they save it will save the value on the field on the parent object.

The field is then referenced on the vf page as:
<apex:inputField value="{!offerSiteList[0].Offer__r.End_Date__c}"/>

Does anyone know what is wrong here? Am I unable to reference a field from a parent object here?
Any help is much appreciated.