• Martijn Schwarzer
  • SMARTIE
  • 1195 Points
  • Member since 2012


  • Chatter
    Feed
  • 34
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 0
    Questions
  • 173
    Replies
I am trying to insert a \ into a string. In front of the date and the end of the date I need to insert the \. Can this be done? 
 
writer.writeAttribute(null,null,'statement', 'LIST POLICIES LAST.ENTRY.DATE GT \7/26/2016\ *OUTPUT* CLIENT.CODE 31 32 33');

 
According to the API guide, I should be able to update the Organization object. 

When I try to update it via annonymous apex, I receive this error: "DML not allowed on Organization". Here's my code: 
Organization o = [Select Name from Organization];
o.City = 'Dallas';
update o;
This was executed by the system admin on the account with "View All Data" enabled. 

Our use case is to allow users to edit their Organization's address through a custom visualforce page made in Skuid. When we were unable to edit this object in Skuid, I tried it in apex to confirm and received the same result. Is there a way to update the Organization information outside of the standard SF page? The documentation suggests so but I have not been successful with it.
Hi !
I want to get for each SObjet the Profil Name, PermissionRead, PermissionWrite, PermissionEdit via Apex.
I tried this :
SELECT O.SobjectType, O.PermissionsRead, PermissionWrite, PermissionEdit,  P.ProfileId, P.Profile.Name
FROM ObjectPermissions O, PermissionSet P
WHERE ( P.Id = O.ParentId) AND (O.SobjectType = 'Account')

But it does'nt work !

Can anyone help me?

Thanks

Hardy
Hi,
I have a Business Goal Object ,now in Campaign ,Business Goal is a lookup field.In list page,I want to display Business Goal NAme instead of Id.
Somewhere I read use Business_Goal__r.Name .But when I do this, it gives error that "
SObject row was retrieved via SOQL without querying the requested field: Campaign.Business_Goal__r 
"
"The new Home page must be called 'Sales Home'."
Can't even find it?
namecheck
Hello,

I have a code which updates an  Old__c which is a object in managed package. it has only one record type which is accessible to system admin

but for line 
//update lstOldToUpdate;

It gives ERROR like
//
Exception : Update failed. First exception on row 0 with id a1eb00000015PrAAAU; first error: INVALID_CROSS_REFERENCE_KEY, invalid cross reference id: []
As data volume may be large, go for batch to achiev this :
global class  BatchClassDemo implements  Database.Batchable<sObject> 
{
    global  BatchClassDemo()
      {

      }
      
      global Database.QueryLocator start(Database.BatchableContext BC){
      
         return Database.getQueryLocator('SELECT Id__c FROM New__c');
      }
      
      global void execute(Database.BatchableContext BC, List<New__c> scope)
      {
         Set<String> setStrId = new Set<String>();
         List<Old__c> lstOldToUpdate = new list<Old__c>();
         for(New__c objNew : scope)
            if(String.isNotblank(objNew.Id__c))
                setStrId.add(objNew.Id__c)
         for(Old__c objOld : [SELECT Id, checkbox__c FROM Old__c WHERE Id IN: setStrId])
         {
            
            lstOldToUpdate.add(new Old__c(Id=objOld.Id, checkbox__c = true));
         }
         
         if(!lstOldToUpdate.isEmpty())
            update lstOldToUpdate;
      }
      global void finish(Database.BatchableContext BC){
        
      }
}

 
  • July 21, 2016
  • Like
  • 0
Hi all,
  I want to two objects(Account,Contact) fields in vf page by using wrapper class 
Please provide me a simple code for it.

Tanking you,
Nagarjuna Reddy Nandireddy
Hi All. My test code is giving a null pointer exception on line 18, and I don't understand why. I'm sure that there is something basic about intializing variables that I'm not understanding. I thought that intializing the variable to 0 would get me around the null pointer exception on line 18, but it's not. 
 
public class createBillingSchedule {
    
    @InvocableMethod
    public static void createBillingSchedule(List<String> PrjIds) {
        Date firstDay = date.today();
        Date lastDay = date.today();
       	Date lastDayOfMonth = date.today();
       	Integer totalDaysInMonth = 0;
       	Integer remainingDaysInMonth = 0;  
        Integer i = 0;
        List<Billing_Schedule__c> bsList = new List<Billing_Schedule__c>();
       
        for(Project__c prj : [select Id, Name, Start_Date__c, End_Date__c, Budget__c, Daily_Budget__c from Project__c where ID IN :PrjIds]) {
                      
            do {
            	i++;
                if(i == 1) { 
                    totalDaysInMonth = Date.daysInMonth(prj.Start_Date__c.year(), prj.Start_Date__c.month());
					lastDayOfMonth = Date.newInstance(prj.Start_Date__c.year(), prj.Start_date__c.month(), totalDaysInMonth);
                    remainingDaysInMonth = prj.Start_Date__c.daysBetween(lastDayOfMonth);
                    firstDay = Date.newInstance(prj.Start_Date__c.year(), prj.Start_date__c.month(), totalDaysInMonth)+1;
                    Billing_Schedule__c bs1 = new Billing_Schedule__c(
                    	Project__c = prj.Id,
                        Requested_Amount__c = remainingDaysInMonth * prj.Daily_Budget__c,
                        Billing_Date__c = lastDayOfMonth,
                        Status__c = 'Waiting to Invoice'
                    );
                    bsList.add(bs1);
                } else if (i > 1 && i < prj.Duration_Months__c) {
                    totalDaysInMonth = Date.daysInMonth(firstDay.year(), firstDay.month());
					lastDayOfMonth = Date.newInstance(firstDay.year(), firstDay.month(), totalDaysInMonth);
                    remainingDaysInMonth = firstDay.daysBetween(lastDayOfMonth);
                    firstDay = Date.newInstance(firstDay.year(), firstDay.month(), totalDaysInMonth)+1;
                    Billing_Schedule__c bs2 = new Billing_Schedule__c(
                    	Project__c = prj.Id,
                        Requested_Amount__c = remainingDaysInMonth * prj.Daily_Budget__c,
                        Billing_Date__c = lastDayOfMonth,
                        Status__c = 'Waiting to Invoice'
                    );
                    bsList.add(bs2);
                } else if (i == prj.Duration_Months__c) {
                    totalDaysInMonth = Date.daysInMonth(prj.End_date__c.year(), prj.End_date__c.month());
					lastDayOfMonth = Date.newInstance(prj.End_date__c.year(), prj.End_date__c.month(), totalDaysInMonth);
                    remainingDaysInMonth = firstDay.daysBetween(prj.End_date__c);
                    Billing_Schedule__c bs3 = new Billing_Schedule__c(
                    	Project__c = prj.Id,
                        Requested_Amount__c = remainingDaysInMonth * prj.Daily_Budget__c,
                        Billing_Date__c = lastDayOfMonth,
                        Status__c = 'Waiting to Invoice'
                    );
                    bsList.add(bs3);
                }
            }
            while (i <= prj.Duration_Months__c);
        }
        insert bsList;
    }

}

 
Can I schedule a normal apex class which has few batch classes executed within it?  For Ex: 
 public class A{
//Some Code....
    BatchCLass B= new BatchCLass();
  Database.executebatch(B,200);
Batchcls C= new Batchcls();
Database.executebatch(C,200);
//Some Code...
}
Now i want to write a scheduler class for Apex class A. Will normal Scheduler class work for this scenario  or is there any restriction from Salesforce on this.
Any leads would be appreciated. 

Thanks in Advance !!!
I'm attempting a trailhead challenge, and completely stuck when working with ui:inputCheckbox.

I can't find in the documentation how I can:

a) determine if the checkbox is checked
b) change it from unchecked to checked (or vice versa).

 
Hi all,
I'm having a problem using the enhancedList.

I'm using this enhancedList:
<apex:enhancedList type="Account" height="600" rowsPerPage="25" customizable="false" id="AccountList" />
but the Last Page button is always disabled

User-added image

Can anyone help me ?

Thanks in advance.
 
Hi All,
       I am doing the ISV trail in Salesforce. In one of the module , i am required to create the test org in partner community. Should i use the same Salesforce Id (off my Developer edition) to create one or should i create a brand new username for the partner edition. I used the log in with salesforce username option/ it gave me this window. User-added image
I didn't know which option to choose. Iam stuck on how to create a new partner profile. Can someone help me with steps on creating a new one. 

Thanks
Dhinesh
The parsing failed when I tried to generate an Apex Class from WSDL file. 
 
This is the error that I received - External schema import not supported.
 
Based on what I am reading in the forum, I need to do the following:
 
1. Inside <wsdl:types> (below the last <schema>) paste each referenced .xsd file content. Paste only <schema></schema>
2. Once all schemas are in the WSDL then comment all <xsd:import> using <!-- -->. They are no longer needed.
3. Please save changes and send back to me.

I am not the one who created the XML file and not sure how to update it with the instructions listed above? I apreciate any help!

Thanks!
 
<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions
     name="SerialInquiry"
     targetNamespace="http://xmlns.oracle.com/pcbpel/adapter/http/QLogicConsolidatedApplication/QLSerialInquiryService/SerialInquiry"
     xmlns:tns="http://xmlns.oracle.com/pcbpel/adapter/http/QLogicConsolidatedApplication/QLSerialInquiryService/SerialInquiry"
     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
     xmlns:msg_in_out="http://www.qlogic.com/soaintegrations/Oracle/xsd/QLSerialInquiryServiceSchema"
     xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
     xmlns:plt="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
    >
    <wsdl:documentation>
        <abstractWSDL>https://fmwtest.qlc.com:8080/soa-infra/services/default/QLSerialInquiryService!1.0/SerialInquiry.wsdl</abstractWSDL>
    </wsdl:documentation>
    <plt:partnerLinkType name="Request_Response_plt">
        <plt:role name="Request-Response_role">
            <plt:portType name="tns:Request_Response_ptt"/>
        </plt:role>
    </plt:partnerLinkType>
    <wsdl:types>
        <schema xmlns="http://www.w3.org/2001/XMLSchema">
            <import namespace="http://www.qlogic.com/soaintegrations/Oracle/xsd/QLSerialInquiryServiceSchema"
                 schemaLocation="https://fmwtest.qlc.com:8080/soa-infra/services/default/QLSerialInquiryService/SerialInquiry?XSD=xsd/QLSerialInquiryServiceSchema.xsd"/>
        </schema>
    </wsdl:types>
    <wsdl:message name="SerialInquiryRequest_msg_in">
        <wsdl:part name="SerialInquiryRequest" element="msg_in_out:SerialInquiryRequest"/>
    </wsdl:message>
    <wsdl:message name="SerialInquiryResponse_msg_out">
        <wsdl:part name="SerialInquiryResponse" element="msg_in_out:SerialInquiryResponse"/>
    </wsdl:message>
    <wsdl:portType name="Request_Response_ptt">
        <wsdl:operation name="Request-Response">
            <wsdl:input message="tns:SerialInquiryRequest_msg_in"/>
            <wsdl:output message="tns:SerialInquiryResponse_msg_out"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="Request_Response_pttBinding" type="tns:Request_Response_ptt">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="Request-Response">
            <soap:operation style="document" soapAction="Request-Response"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:binding name="Request_Response_ptHttpPOST" type="tns:Request_Response_ptt">
        <http:binding xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" verb="POST"/>
        <wsdl:operation name="Request-Response">
            <http:operation xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" location=""/>
            <wsdl:input>
                <mime:content xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" type="text/xml"/>
            </wsdl:input>
            <wsdl:output>
                <mime:content xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" type="text/xml"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="SerialInquiry">
        <wsdl:port name="Request_Response_pt" binding="tns:Request_Response_ptHttpPOST">
            <http:address xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" location="https://fmwtest.qlc.com:8080/soa-infra/services/default/QLSerialInquiryService/SerialInquiry"/>
        </wsdl:port>
        <wsdl:port name="Request_Response_pt_soappt" binding="tns:Request_Response_pttBinding">
            <soap:address location="https://fmwtest.qlc.com:8080/soa-infra/services/default/QLSerialInquiryService/SerialInquiry"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

 
We need to create SF users in VF and Apex, and I want to show the users a count of how many remaining licences they have.

Is there any way of finding this out using Apex?

I have a form where I allow the user the option to randomly generate a password, or enter one.  If the user chooses to generate a random password, then I want the password entry field to disappear, and the "must change password on first login" to be checked.  If the user doesn't generate a random password, then I want the password entry field to appear, and the other checkbox to be unchecked.

Unfortunately, no combination of event names or outputpanels will actually cause the function in the controller to run; it steadfastly refuses to execute.  I've put in a deliberate "blow up" statement to make absolutely sure that the function isn't running.  What do I need to do to get this code to execute?

Here is the relevant portion of the page:

            <apex:pageBlockSection columns="2" id="SecuritySection" title="Security Information">
                <apex:pageblocksectionitem >
                    <apex:outputlabel for="generate" value="Generate random password" />
                    <apex:inputCheckbox id="generate" value="{!generatePassword}">
                        <apex:actionSupport event="onchange" action="{!changeGenerate}" reRender="forcePanel, passwordPanel" status="generateChangeStatus" />
                    </apex:inputCheckbox>
                </apex:pageblocksectionitem>
                <apex:pageblocksectionitem >
                    <apex:outputpanel id="forcePanel">
                        <apex:outputlabel for="forcechangepassword" value="Must change password on first login" />
                        <apex:inputcheckbox id="forcechangepassword" value="{!forceChangePassword}" />
                    </apex:outputpanel>
                </apex:pageblocksectionitem>
                <apex:pageblocksectionitem >
                    <apex:outputpanel id="passwordPanel" >
                        <apex:outputlabel for="password" value="Use this password" />
                        <apex:outputpanel >
                            <div class="requiredInput">
                                <div class="requiredBlock"></div>
                                <apex:inputsecret id="password" value="{!password}" required="true" />
                            </div>
                        </apex:outputpanel>
                    </apex:outputpanel>
                </apex:pageblocksectionitem>
                <apex:actionstatus id="generateChangeStatus" starttext="Changing security options..." stoptext="" />
            </apex:pageBlockSection>

And here is the controller function:

    public PageReference changeGenerate() {
        System.assertEquals(1,null);
        forceChangePassword = generatePassword;
        return null;
    }
 

Hi ,

 We need to query accounts along with contacts associated for each account and dispaly them in the following format.

1)Dispaly all accounts in a table
2)For each account we need to dispaly associated contacts in a child table for that account
i.e. For each row(account) we need to display contacts table(contacts for that account).

Can some one please help how to achieve this.

***Any help is really appreciated.

Thanks,
Naveen.
User-added image
Hi,
    i am currently doing the above mentioned challenge in the salesforce trailhead. I creatd a permission set and assigned it to the user like it was mentioned and even logged in using the two factor authentication method. but still it is showing challenge not complete. Is there any reason to this. I don't know what i am missing. The following is the error message i received

Challenge Not yet complete... here's what's wrong:
Could not find a user's successful login using two-factor authentication. Make sure you successfully login at least once and that you are prompted for a second factor of authentication

Any help wpuld be appreciated
Hello,

I got new project on salesforce Security [ Identity and Access managment ] which is new to me. So can any one provide me the pointers by which i am able to learn these concept quickly.
Is there any trailhaid provided by salesforce to learn these concepts?
How i explore salesforce security concept ?

Please help me on this.

Thanks,
Sagar
Hi there  - Is it possible to view an entire list of all APEX classes for a given org without having to keep clicking on the 'next page' or 'show more' link. I notice that it maxs out at 1000 records when clicking either of these links, which presents an issue if the org has more than 1000 APEX class records and one is trying to document an entire listing of what is there.

Thanks - Jeff
I have three objects. Accounts, Consortiums, Campuses and have set up a many to many relationship between Consortiums and Accounts. And also from Campuses and Accounts. I've done this by creating two junction objects that sit inbetween. This enables me to add more than one consortium to an account, and more than one account to a consortium. I am looking for ways to prevent duplicate records being created. Can I do this by validation rule, or will I need to write a trigger?
Hi,

I have built two VF pages. One VF , shows all the appointments and when the subject field is clicked, detial page is opened(2ns VF Pgae).
On this detail page we have link field Who(from events object), which is a lookup field to Contact and Lead.
Now when i click on the link, based on the value it should navigate to contact or lead detail page. How do we do it.
I tired onclick, funciton in class but its not working.
 
  • July 28, 2016
  • Like
  • 0
Hi all,
I am not sure how to write test class for this method. Any help would be greatly appreciated!! 
    public List<SelectOption> getDiningTimeOptions()
    {
        List<SelectOption> options = new List<SelectOption>();
        List<String> Times = this.getDynamicPicklistValues('Intake__c', 'Time__c');
        for (String Time : Times)
        {
            options.add(new SelectOption(Time, Time));
        }

        return options;
    }
 
I am trying to insert a \ into a string. In front of the date and the end of the date I need to insert the \. Can this be done? 
 
writer.writeAttribute(null,null,'statement', 'LIST POLICIES LAST.ENTRY.DATE GT \7/26/2016\ *OUTPUT* CLIENT.CODE 31 32 33');

 
According to the API guide, I should be able to update the Organization object. 

When I try to update it via annonymous apex, I receive this error: "DML not allowed on Organization". Here's my code: 
Organization o = [Select Name from Organization];
o.City = 'Dallas';
update o;
This was executed by the system admin on the account with "View All Data" enabled. 

Our use case is to allow users to edit their Organization's address through a custom visualforce page made in Skuid. When we were unable to edit this object in Skuid, I tried it in apex to confirm and received the same result. Is there a way to update the Organization information outside of the standard SF page? The documentation suggests so but I have not been successful with it.
Hi !
I want to get for each SObjet the Profil Name, PermissionRead, PermissionWrite, PermissionEdit via Apex.
I tried this :
SELECT O.SobjectType, O.PermissionsRead, PermissionWrite, PermissionEdit,  P.ProfileId, P.Profile.Name
FROM ObjectPermissions O, PermissionSet P
WHERE ( P.Id = O.ParentId) AND (O.SobjectType = 'Account')

But it does'nt work !

Can anyone help me?

Thanks

Hardy
I am have a workflow rule which updates the field on quote and creates task 3 Days Before Quote Expiration Date.I have to move this rule to Process Builder and I can only see two evaluation criteria in process builder:

User-added image

The workflow rule has third evaluation criteria "Evaluate the rule when a record is created, and any time it's edited to subsequently meet criteria".What is equivalent of this criteria in Process builder?What should I select for this criteria in Process Builder?
Is "Recursion - Allow process to evaluate a record multiple times in a single transaction" same as above criteria?
I am looking for a way to fill out PDF forms programatically (and for free, so not Conga). We have a way to fill out DOCX forms, so either we need a way to convert DOCX to PDF client side, or a way to merge data into a PDF. This needs to be accomplished with a single click from the user, and uploaded directly to a file sharing site without any further user intervention. The program also needs to be Win10 compatible, so ActiveX is not a viable solution. It also should function without any preexisting custom code on the computer at hand, although it can be assumed that Adobe Acrobat and Microsoft Word will be available on the computer.  I also need to be able to take in an arbitrary PDF document or Word document as the input, which prevents the use of the renderas feature as being a solution. 

I am capable of writing custom code for this, however as far as I know, there is no PDF library for Javascript (excluding Node.IO) or Apex. I already have functioning code that edits the text in the DOCX, I would just need to convert it to PDF clientside somehow.
 

Hello,
I am trying to integrate SalesForce Suite with my Drupal site and I keep getting the following error:

error=redirect_uri_mismatch&error_description=redirect_uri%20must%20match%20configuration

I tried looking for a resolution or a reason WHY this is happneing and I have gotten nowhere.  See setup below.  Does it have to do with the endpoint URL??  Any help with this would be greatly appreciated.

Thanks!

Drupal Error

Hello,

I have completed my apex specialist superbadge in first attempt but I did not receive any special badge related to first time ascent.

Does it take some time to get updated as I can only see simple super badge in my trailhead profile. 

Arpit
Hi Friends, 

Need quick help with a trigger for below cenario. 

Lets say i have a "Company" object and "Industry" field in it with values (CIP, FED, OTH) , Now when ever Company record is updated with Industry values child object "Job" field "Industry" should be updated catch is here if CIP is selected in child object it should show 
Consumer and Industrial Products if FED is selected in company in job it should show up Federal (Basically it should map the field)
  • July 25, 2016
  • Like
  • 0
Hi All,

I have a object Test which has two list views say ListView 1 and ListView2.
In object Test I have a field based on the value (YES or NO) need to display the user either of the list view on tab click.
Currently I am displaying only one listview on tab click using the below :
<apex:page showHeader="true" tabStyle="Test_c" action="/a1t?fcf=00BP0000000WMHv" ></apex:page>
Now need to add condition to it.Please Help...

Thanks in Advance for Any Help...!
Hi Experts,
I am writing a test class to the below  trigger, in our test class  am using @isTest(SeeAllData=true) then I got code cover age , according to our requirement am using only @istest then I didn’t received the code coverage , then am getting bellow error

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, emailtoQueueonCaseOwnerchange: execution of AfterUpdate

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

Trigger.emailtoQueueonCaseOwnerchange: line 19, column 1: []
trigger ParentCaseGBOAge on Case ( after update) 
{

    Set<Id> recordIds = new Set<Id>();
    Set<Id> parentIds = new Set <Id>();
       
    for (case c : Trigger.new)
        
        if( AvoidRecursion.isFirstRun())
    {
        if ( c.RecordTypeId == Schema.Sobjecttype.case.getRecordTypeInfosByName().get('GBOCase').getRecordTypeId() && c.parentid == null && c.status == 'Closed')
             {
             parentIds.add(c.id);
             }
    }
    system.debug('@@@@'+ParentIds.size());
    if (parentIds.isEmpty() == false) 
      {
     
        //List <case> caseparent = [Select id, Parent_BDT_Case_Age__c,Parent_COM_Case_Age__c,Parent_LSR_Case_Age__c, Parent_PDT_Case_Age__c   from case where id in :ParentIds ];
        Map<ID,Case> ResultMap = new Map <ID,Case> ([Select id, Parent_BDT_Case_Age__c,Parent_COM_Case_Age__c,Parent_LSR_Case_Age__c, Parent_PDT_Case_Age__c   from case where id in :ParentIds ]);
       // Map<ID,Case> ResultMap = new Map <ID,Case> ();
        AggregateResult[] groupedResults = [select max(ParentID) ParentID, sum(BDT_Case_Age__c)childsum1, sum(COM_Case_Age__c) childsum2, sum(PDT_Case_Age__c) childsum3, sum(LSR_Case_Age__c) childsum4 from case  where parentid in :ParentIds or Id in:ParentIds];    
        for (AggregateResult Ar : groupedResults)
         {
           ID resultID = (ID)Ar.get('ParentID');
           case cupd = ResultMap.get(resultID);
           cupd.Parent_BDT_Case_Age__c = (Decimal) Ar.get('childsum1');
         cupd.Parent_COM_Case_Age__c = (Decimal) Ar.get('childsum2');            
           cupd.Parent_PDT_Case_Age__c = (Decimal) Ar.get('childsum3');
           cupd.Parent_LSR_Case_Age__c = (Decimal) Ar.get('childsum4');
           //Resultmap.remove(resultID);
           ResultMap.put(resultID,cupd); 
           system.debug('$$$$$$' + ResultMap.values());  
           system.debug('^^^^'+cupd.Parent_BDT_Case_Age__c);  
        }   
      
              
  
        if(ResultMap.values().size() > 0)
        {  
           List <Case> CasestobeUpdated = new List <Case>();
            for (Case cu : [Select id, Parent_BDT_Case_Age__c,Parent_COM_Case_Age__c,Parent_LSR_Case_Age__c, Parent_PDT_Case_Age__c   from case where id in :ResultMap.keySet()]  )
            {
                cu.Parent_BDT_Case_Age__c = ResultMap.get(cu.id).Parent_BDT_Case_Age__c;
                cu.Parent_COM_Case_Age__c = ResultMap.get(cu.id).Parent_COM_Case_Age__c;
                cu.Parent_PDT_Case_Age__c = ResultMap.get(cu.id).Parent_PDT_Case_Age__c;
                cu.Parent_LSR_Case_Age__c = ResultMap.get(cu.id).Parent_LSR_Case_Age__c;
                CasestobeUpdated.add(cu);
            }
           
            update CasestobeUpdated;
         
         //  upsert ResultMap.values() ID ;
         //   system.debug('$$$$$ '+ResultMap.size());
        }   

    }
} 

//

Test class 

@isTest(SeeAllData=true)
 public class ParentCaseGBOAgeTest{
 public static testmethod void casemethod()
 {
 
 Id caseRecordTypeId = Schema.Sobjecttype.case.getRecordTypeInfosByName().get('GBOCase').getRecordTypeId();
 List<Case> caseList=new List<Case>();
 
 Case ParentCase=new Case(status = 'Closed',
 Origin='Phone',
 
 RecordTypeId=caseRecordTypeId,
 Parent_BDT_Case_Age__c=12345.0000,
 Parent_COM_Case_Age__c=20000.0000,
 Parent_LSR_Case_Age__c=30000.0000,
 Parent_PDT_Case_Age__c=25000.0000,
 To__c='Business Data Team Incoming');
 caseList.add(ParentCase);
 
 Case Objcase1=new Case(status = 'Closed',
 Origin='Phone',
 
 RecordTypeId=caseRecordTypeId,
 Parent_BDT_Case_Age__c=12345.0000,
 Parent_COM_Case_Age__c=20000.0000,
 Parent_LSR_Case_Age__c=30000.0000,
 Parent_PDT_Case_Age__c=25000.0000,
 To__c='COM');
 caseList.add(Objcase1);
 
 Case Objcase2=new Case(status = 'Closed',
 Origin='Phone',
 
 RecordTypeId=caseRecordTypeId,
 Parent_BDT_Case_Age__c=12345.0000,
 Parent_COM_Case_Age__c=20000.0000,
 Parent_LSR_Case_Age__c=30000.0000,
 Parent_PDT_Case_Age__c=25000.0000,
 To__c='Product Data Team Incoming');
 caseList.add(Objcase2);
 
 Case Objcase3=new Case(status = 'Closed',
 Origin='Phone',
 
 RecordTypeId=caseRecordTypeId,
 Parent_BDT_Case_Age__c=12345.0000,
 Parent_COM_Case_Age__c=20000.0000,
 Parent_LSR_Case_Age__c=30000.0000,
 Parent_PDT_Case_Age__c=25000.0000,
 To__c='Customer Support');
 caseList.add(Objcase3);
 //Insert ParentCase;
 
         try{
        insert caseList;
        }
        Catch(Exception E)
        {}
        
        }
        
   }


.//in our test class it's not covered// please help me .how to I can fix this issue
User-added image

 
Not able to update the User email field in database eventhough the logic is correct and also debug log shows that the Email field update is done. But not able to see the same in database.

global class UserEmailupdates implements Database.Batchable<sObject>
{
    User1__c uc = User1__c.getValues('Domainuser'); 
    String inteluc = uc.Domain__c;
//    List<User> userlist=new List<User>;


    global Database.QueryLocator start(Database.BatchableContext BC)
    {
        String query = 'SELECT name,Username,UpdatedEmail__c,email,userrole.name,profile.name From user where userrole.name = \'CRM Developer\'';
        return Database.getQueryLocator(query);
    }

    global void execute(Database.BatchableContext BC, List<User> scope)
    {
        for ( User u : scope)
        {
          if(u.userrole.name == 'CRM Developer')
           {  
               if(u.username.Contains('@example.com'))  
               {       
               String str=u.username;
               String str1=u.email;
//             String username1;
               u.username=str.substringbefore('@');
               u.username=u.username.replace('=','@');
               u.Email=str1.substringbefore('@');
               u.Email=u.Email.replace('=','@');
               System.debug('Email = ' + u.Email);
               System.debug('User name = ' + u.Username);  
               }
               else
               {
               String str=u.username;
               String str1=u.Email;
               u.username=str.substringbefore('@');
               u.username=u.username+inteluc;
//             u.Username =u.DomainUser__c+inteluc;
               u.Email=str1.substringbefore('@');
               u.Email =u.Email+inteluc;
               
               System.debug('Email = ' + u.Email);
               System.debug('User name = ' + u.Username);     
               }
           }
           
        }
        update scope;
        System.debug('Scope is= '+ Scope);
    }  
    global void finish(Database.BatchableContext BC)
    {
    }
}

Below is the debug log details
global class UserEmailupdates implements Database.Batchable<sObject>
{
    User1__c uc = User1__c.getValues('Domainuser'); 
    String inteluc = uc.Domain__c;
//    List<User> userlist=new List<User>;


    global Database.QueryLocator start(Database.BatchableContext BC)
    {
        String query = 'SELECT name,Username,UpdatedEmail__c,email,userrole.name,profile.name From user where userrole.name = \'CRM Developer\'';
        return Database.getQueryLocator(query);
    }

    global void execute(Database.BatchableContext BC, List<User> scope)
    {
        for ( User u : scope)
        {
          if(u.userrole.name == 'CRM Developer')
           {  
               if(u.username.Contains('@example.com'))  
               {       
               String str=u.username;
               String str1=u.email;
//             String username1;
               u.username=str.substringbefore('@');
               u.username=u.username.replace('=','@');
               u.Email=str1.substringbefore('@');
               u.Email=u.Email.replace('=','@');
               System.debug('Email = ' + u.Email);
               System.debug('User name = ' + u.Username);  
               }
               else
               {
               String str=u.username;
               String str1=u.Email;
               u.username=str.substringbefore('@');
               u.username=u.username+inteluc;
//             u.Username =u.DomainUser__c+inteluc;
               u.Email=str1.substringbefore('@');
               u.Email =u.Email+inteluc;
               
               System.debug('Email = ' + u.Email);
               System.debug('User name = ' + u.Username);     
               }
           }
           
        }
        update scope;
        System.debug('Scope is= '+ Scope);
    }  
    global void finish(Database.BatchableContext BC)
    {
    }
}


Debug log info is attached.

Input data :

User Name : suri101070@gmail.com
Email : suri101070@gmail.com

Output expecting :

User name : suri101070@intel.com
Email : suri101070@intel.com

But here can see the username getting updated in database but email field is not getting updated. Is Salesforce is enforcing any rule/restriction and preventing the Email field Update?Debug log info
Hi there,

I have a custom field that follows the user language and this is working fine. 
For some reason, in a particular location I need to show this field value in English only, ignoring the system translation. 

How to achieve that? Is there a way to force a language in a formula field result? 

Thank you!
Hi All,
I have created "Electronic_Device__c" as cusom object and added two picklist in that.
1.Device Type(Master Picklist)
2.Device_Name__c

VF Page Code
 <apex:page controller="FieldSetTest" tabStyle="Product2">
  <apex:form >
       <apex:pageBlock >
            <apex:pageBlockSection title="Device Details" collapsible="False" columns="1">
                <apex:repeat value="{!$ObjectType.Electronic_Device__c.FieldSets.Device_Field_Set}" var="f"> 
                    <apex:inputField required="{!f.Required}" value="{!device[f]}" />
                </apex:repeat>
            </apex:pageBlockSection>
       </apex:pageBlock>
    </apex:form>
</apex:page>

Controller code:-

public class FieldSetTest{
 public Electronic_Device__c device { get; set; }
     
 public FieldSetTest(){
     device = new Electronic_Device__c();
 }
}


I am able to acheive 90% percent but when I running tha page output display this way...
Not visible Device name...why..??
Hi,
    i am currently doing the above mentioned challenge in the salesforce trailhead. I creatd a permission set and assigned it to the user like it was mentioned and even logged in using the two factor authentication method. but still it is showing challenge not complete. Is there any reason to this. I don't know what i am missing. The following is the error message i received

Challenge Not yet complete... here's what's wrong:
Could not find a user's successful login using two-factor authentication. Make sure you successfully login at least once and that you are prompted for a second factor of authentication

Any help wpuld be appreciated

When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.  

 

That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it.