• chiranjeevitg
  • NEWBIE
  • 65 Points
  • Member since 2010
  • Consulatnt

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 37
    Replies

I am getting an error while running the test class , Leads are not getting created in the system ..

 

Test class snipet :


  Lead testLead = Class_Test.createLead('Test Lead', 'Test Company', '02s30000000000dAAB', 'Core');
    testLead.OwnerId = user.Id;
    insert testLead;

    system.assertEquals(testLead.OwnerId, uSBS.Id);  

 ---------------------

Class_Test :

 

public static Lead createLead(String lastName, String company, Id divId, String status){
   
    Datetime t = Datetime.now();
    Date da = Date.newInstance(t.year(), t.month(), t.day());
    Lead lead = new Lead(LastName = lastName, Company = company, Division = divId, Status = status, Phone = '1234', Start_Date__c = da);
   
    return lead;
  } 

 

Error :

 

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, EZAssign.CS_Lead: execution of AfterInsert

caused by: System.DmlException: Upsert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, EZAssign.CS_UserInfo: execution of AfterInsert

caused by: System.DmlException: Update failed. First exception on row 0 with id 005e00000012MJJAA2; first error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): User, original object: Lead: []

(EZAssign)
: []

(EZAssign)


: []

 

 

Any idea how to rectify this error

I have a csv full of contacts in a server that can be accessed through FTP. What I need is to get that csv and upload it to salesforce every 4 hours. I also need to avoid creating duplicate contacts at the upload time . Besides that, I have to create upload rules that some fields do not change the information if it was changed in Salesforce. For example, i upload a second time the telephone from John, in the csv its 1-800-000-00000 but in salesforce its 1-800-000-00001, so the Salesforce information of that field goes first than the csv. With other fields its the other way around, like an email address in the csv goes first than the email from Salesforce. Any idea how to do this? Thank you very much.

Hi,

 

I need to add space/tab space between two radio buttons. I am passing the values for radio button through controller using <apex:selectOptions>. Please help to resolve this

 

 

Thanks & Regards,

Chiranjeevi T G

Hi,

 

I am trying to cover the test coverage for getter setter part, but I am unable to cover, Please suggest me to get the coverage.

 

public String strCurrentPageAlerts{
    get{         
        String temp1 = PageUrl.subString(0,12);       
        return 'https://'+BaseURL+temp1;
        }set;
    }
    public String strCurrentPage{
    get{
        String temp = PageUrl.subString(0,14);
        return 'https://'+BaseURL+temp;
        }set;
    }

 when i tried the below code I am able to cover only first lines.

 

 

MyController cntrl = new MyController();
cntrl.strCurrentPageAlerts = 'test';
cntrl.strCurrentPage = 'test1';

 

Thanks.

Hi,

 

I have created a formula field of Currency Type, In this i'm referring another standard currency field name Amount.

As this standard currency field is doing currency conversion i'm not able to display this amount field in visualforce page.

So I have created a formula field and referring that Standard Amount field. I'm able to display the value in visualforce page, but if the Actual amount is USD 125.00, in visualforce page it displays USD 125.0.

 

Is there any way to display the decimal values properly?

 

Thank You.

 Hi All,

 

I have developed a visualforce page and rendered that page as PDF. I have applied font styles and css styles.

When i render the page as PDF font styles are not applied on PDF, but if make it as simple vf page i'm able to see the font style changes. Please help me to sort out this issue.

 

Thank you.

Hi,

 

I have created a search page for opportunity, after entering the search criteria the results will be displayed in Page block table. I have added the pagination for pageblock table. I'm displaying 10 results per page. When i click next link it will populate the next set of 10 records, but when i click previous link i'm seeing all the results in the list.

 

I have enclosed the code here.

 

 

public void search()
    {
	SearchRecVals.Clear();
    	//SortDir = 'asc';
    	List<Opportunity> OldRecs = [SELECT Id, Name, Query__c FROM Opportunity WHERE RecordTypeId =: '012800000007ALV'];
    	
    	try
    	{		
    		 
    		 qryVal = OldRecs[0].Query__c; 
    		 System.debug('Query----------------->>>>>>'+OldRecs[0].Query__c);
    		 OppRecvals = Database.query(OldRecs[0].Query__c + ' order by ' + sortField + ' ' + sortDir);
    		 //OppRecVals = DataBase.Query(OldRecs[0].Query__c + ' order by ' + sortField + ' ' + sortDir + ' limit 10');
    		 System.Debug('Searched Query--------->'+OldRecs[0].Query__c);  
    		 System.Debug('Size Of Oppvals---------->>>>>>'+OppRecvals.Size());
    		 
             //ListSize = 'Total number of records found: '+String.ValueOf(OppRecvals.Size());
    		 ListSize = String.ValueOf(OppRecvals.Size());
    	//try{	 
    		if(OppRecVals.Size()>10)
    		{
    			for(i=0;i<10;i++)
    			{
    				searchRecVals.add(OppRecVals[i]);
    			}
    		}
    		else
    		{
    			searchRecVals = OppRecvals;
    		}
    	}
    	catch(Exception e)
    	{
    		System.Debug('Exception------>:'+e);
    	}
}

 

 

 

Next Link Code

 

public pageReference next()
    {
    	Integer temp = 0;
    	if(OppRecVals.Size()>10)
    	{  
    		/* i's Current Value is 10 */
    		if(i<OppRecVals.Size())
    		{
    			SearchRecVals.Clear();
    			/* Fetching next 10 records by incrementing i = 10 to 20 */
    			i=i+10;
    			System.Debug('Value Of I---------------------->>>>>>>>>>>>>>>>>'+i);
    			/*so now i=20 so trying to fetchnext 10 records by iteratingb thru loop of j*/
    			for(j=j+10;j<i;j++)
    			{ 
    				/* j=10 now initially*/
    				/*10 is < suppose if total there are 20 records*/
  
    				if(j<OppRecVals.Size())
    				{
    					SearchRecVals.add(OppRecVals[j]);
    					temp++;
    				}
    				else
    				{
    					break;
    					j = j- 10;
    				}
    			}
    			getOppRecVals();
    		}//getOppRecVals();
    	}
    	
    	else
    	{
    		SearchRecVals = OppRecVals;
    		if((temp != 10) && (flag == 0))
    		{
    			j = j-temp + 10;
    			flag = 1;
    			system.debug('temp j:'+j);
    			
    		}
    		
    	}
    	return null;	
    }

 

 

 

Previous Link Code:

 

 

public Pagereference prev()
    {
	if(OppRecVals.Size()>10)
    	{
    		integer firstval,secval;    		
    		integer temp=j/10;
    		//SearchRecVals.Clear();
    		//i=i-10;
    		if(temp>0)
    		{
    			
    			firstval=(temp-1)*10;
    			secval=temp*10;
    			
    		}
    		else
    		{
    			
    			firstval=temp;
    			secval=10;
    		}
    		for(j=firstval;j<secval;j++)
    		{
    			
    			SearchRecVals.add(OppRecVals[j]);
    			if(OppRecVals.Size()==j)
    			{
    				break;
    			}
    			
    		}
    	}
    	return null;
    }

 

 

Please help me to solve this problem.

 

Thank you.

 

Hi,

 

I'm creating a custom button with URL type, I'm checking the condition based on Picklist, if the picklist value is YES i want to open a window with the link provided in true condition. Here when i click the button the window opens and shows the error message Broken URL or URL no longer Exists.

 

I am attaching the Formula i have tried, Please help me to solve this issue.

 

 

{!IF( ISPICKVAL(Quote.Approved__c, "YES"),
"https://www.xxxxxx.com/apps/xxxxx/PointMerge.aspx?SessionId= "+"$Api.Session_ID&ServerUrl=API.Partner_Server_URL_80&Id= Quote.Id &TemplateId=01HS000000005O0&ds4=1&"+"DefaultLocal=0&fp0=1&ds5=1&ds6=1&DefaultPDF=1", 
null)}

 

Thank you

 

Hi,

 

I'm developing a visualforce page, in that i want to pass the string url from controller to page and then i want to store the output value in Javascript variable. Here i'm able to pass the value from controller to visaulforce pag, but i'm not able to store the output value to javascript variable. When i pass the javascript variable in alert it shows undefined. Can any one please help me to solve this issue.

 

 

visualforce Code

<apex:page standardcontroller="quote" extensions="ApprovalCheck" showHeader="false" sidebar="false">
<apex:form id='form1'>

    
     <apex:actionFunction name="getAPIParams" id="getAPIParams" action="{!temp}" reRender="theForm" >
         <apex:param name="sessionId" assignTo="{!apiSessionId}" value="{!$Api.Session_ID}" />
         <apex:param name="serverURL" assignTo="{!apiServerURL}" value="{!$Api.Partner_Server_URL_140}" />
     </apex:actionFunction>
    
    <apex:actionFunction name="popUp" id="popUp" action="{!temp}" reRender="theForm" >
    </apex:actionFunction>
   <apex:outputText id="Msg" value="{!Msg}"></apex:outputText>
  <!-- <apex:outputLink value="{!Msg}">Click Here</apex:outputLink> -->
    
    <script type="text/javascript">
     window.onload = function() { getAPIParams();}
        function openWindow()
        {
            var url = document.getElementById("{!$Component.form1.Msg}").value;
            alert(url);
            myref = window.open(url);
            
        }
    </script>
        <!--<apex:commandButton value="Save" action="{!save}" title="Clone"/>-->
        
        
        <apex:commandButton value="Product With Incentives" action="{!temp}"/>
        <apex:commandButton value="Click Here" onclick="openWindow()"/>
   

</apex:form>
</apex:page>

 

Apex Class

public class ApprovalCheck {
    
    public ApprovalCheck(ApexPages.StandardController controller) {
     
    }
    public static string url{get; set;}
    public static string Msg{get; set;}
    public String apiSessionId {get;set;} 
    public String apiServerURL {get;set;} 

    public void temp()
    {
        String Record_Id = ApexPages.CurrentPage().getParameters().get('id');
        System.debug('apiSessionId: ' + apiSessionId); 
        System.debug('apiServerURL: ' + apiServerURL); 

        List<Quote> AllQuotes = [SELECT Id, Name, OpportunityId, ContactId, ExpirationDate, Status, Email, Phone, Fax, 
                             IsSyncing, Description, Primary_Secondary__c, TotalPrice__c, Tax, ShippingHandling, BillingName, 
                            BillingStreet, BillingState, BillingPostalCode, BillingCity, BillingCountry,
                             ShippingName, ShippingStreet, ShippingState, ShippingPostalCode, ShippingCity,
                             ShippingCountry, (Select Id, TargetObjectId, StepStatus
                             From ProcessSteps) FROM Quote WHERE Id =: Record_Id];
    
        List<Quote> NewVals = new List<Quote>();
                              
        for(Quote q1 :AllQuotes)
        {
            for(ProcessInstanceHistory p1:q1.ProcessSteps)
            {
                if(p1.StepStatus == 'Approved')
                {
                    //Msg = 'https://www.appextremes.com/apps/Conga/PointMerge.aspx?SessionId={!API.Session_ID}&ServerUrl={!API.Partner_Server_URL_80}&Id='+ Record_Id+'&TemplateId=01HS000000005Ms&ds4=1&DefaultLocal=0&fp0=1&ds5=1&ds6=1&DefaultPDF=1';
                    Msg = 'https://www.xxxxxxx.com/apps/xxxxx/PointMerge.aspx?SessionId='+ apiSessionId +'&ServerUrl='+ apiServerURL +'&Id='+ Record_Id+'&TemplateId=01HS000000005O0&ds4=1&DefaultLocal=0&fp0=1&ds5=1&ds6=1&DefaultPDF=1';
                }
                else if(p1.StepStatus == 'Pending')
                {
                    Msg = 'Not Approved';
                }
           }
        }
        
    }
}

 

Thank you.

 

Hi,

 

I have one standard Object Campaign and one custom object sub campaign. I want to add filter criteria in master detail relationship while Sub-Campaign looking up the records in Campaign object. But while creating the Master - Detail relationship or Lookup relationship i didn't find adding filter criteria on that. I want to lookup the campaign records based on record type.

 

Please help me to solve this issue.

Hello! 

I'm trying to create the Einstein Vision Lightning App per this trailhead (https://trailhead.salesforce.com/projects/build-a-cat-rescue-app-that-recognizes-cat-breeds/steps/cat-recognition-app-ui-einstein-vision). I added the Apex Class and Lightning Component as shown, but when I add the component or try to use it I get this error:
User-added image

Any idea what this is or how to fix?
Thanks!

Hi All,

 

Is there any way to test blank values for Integer fileds, for Strings fields

if( Str == '') or Isblank(Str) ...

Any help must be highly appreciated.

Thanks in advance !



Hi,

 

I have written a batch class to send an email when there is a mismatch between two fields, In Execute method i have added the list of records having a mismatch in a list. I need to send the list as an attachment in a single mail. In the below code i am sending the mail in execute method, so for each and every mismatch record i am getting individual mail. But instead i need the whole list to be inserted in the mail body or as an attachment and send only one mail. Mail should not be sent for individual records.

 

Please let me know how to send only one mail with the list of records inserted in mail body or as an attahment and also let me know how to pass the list of records present in execute method to finish method.

 

PFB my sample code,

 

global class SendMail implements Database.Batchable<SObject>

{
List<User> usersList = new List<User>();


global Database.QueryLocator start(Database.BatchableContext BC)

{

return Database.getQueryLocator('select id,Name,EmployeeNumber,NewEmail__c,Testing__c,Email from User');

}

global void execute(Database.BatchableContext BC,List<Sobject> scope)

{

for(Sobject s : scope)

{
    User a = (User)s;
    if(a.EmployeeNumber != a.Testing__c || a.Email != a.NewEmail__c )
    usersList.add(a);
}

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();

String[] toAddresses = new String[] {'Srinivasanece@gmail.com'};

mail.setToAddresses(toAddresses);

mail.setSubject('Apex Batch Job is done');

For(User p:usersList){

mail.setPlainTextBody('The batch Apex job processed'+p.id);

}

Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

}

 

global void finish(Database.BatchableContext BC)

{
/*Mail to User mentioned in the "toAddress"*/   
/*Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();

String[] toAddresses = new String[] {'srinivasanece90@gmail.com'};

mail.setToAddresses(toAddresses);

mail.setSubject('Apex Batch Job is done');

mail.setPlainTextBody('The batch Apex job processed');

Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
*/
}

}

 

Hi,

 

I need to add space/tab space between two radio buttons. I am passing the values for radio button through controller using <apex:selectOptions>. Please help to resolve this

 

 

Thanks & Regards,

Chiranjeevi T G

Hi Developers , 

 

Can anyone help me in resolving this issue ?

 

ERROR : the image is not getting display in a page .

 

How to show loading image while Ajax call in Visualforce? OR how to show image in <apex:actionStatus> tag in Visualforce?

 

<apex:page >
 
 <div style="position:absolute;top:20px;left: 50%;">
 
      <apex:actionStatus id="refreshContent" >
 
             <apex:facet name="start" >
 
               <apex:image url="{!$Resource.waterlilies}" />
 
       </apex:facet>
 
      </apex:actionStatus>
 
  </div>
 
</apex:page>

 

Thanks in Advance

  • September 12, 2013
  • Like
  • 0

Hi,

 

I want to change background color of  home page on customer portal.

 

 

 

Thanks,

Sagar

I want a login page for a customer portal that uses an image for the background.

 

I tried various approaches.

I first did the following:

  • Saved my image in Documents
  • Created and html file and saved it in Documents
  • Went to Customize > Customer Portal > Settings > Portal Name> Edit > Under the section "Look and Feel", in the Login Message, I  uploaded the html file

The problem I am encountering is that the css/html code for the background image gets striped away on the portal login page. It does show up when I view it inside the portal. I tried posting the code in the html file and in the css file, but it’s gone once it hits the browser.

My html file:

<apex:page>

<apex:stylesheet value="{/Resources.ForteStyles.css}" />

<apex:form id="loginForm" forceSSL="true">

<div style ="background-image: url(https://cs3.salesforce.com/resource/1366889013000/portal_page_bg);

background-repeat:no-repeat; height:500px;padding:120px 80px 80px 80px;" >

<div id="loginBackground">

<h3>Welcome to Forte Customer Portal.</h3>

<form action="" onsubmit="return login()" id="loginform" method="post">

 <p id="notification"></p>

<!-- TEXTBOXES -->

<label>User name</label><br />

<input name="username" type="text" class="text large required" id="username" /><br />

<div class="clearfix">&nbsp;</div>

<label>Password</label><br />

<input name="password" type="password" class="text large required" id="password" /><br />

<div class="clearfix">&nbsp;</div>

<p><input name="btnLogin" type="submit" class="submit" id="btnLogin" value="LOGIN" /></p>

</form>

</div> 

</apex:page>

 

I also tried defining it in my css file and that wasn't successful either:

#loginBackground ( background-image: url(https://cs3.salesforce.com/resource/1366889013000/portal_page_bg);

background-repeat:no-repeat; height:500px;padding:120px 80px 80px 80px;

}

 

And in my html file:

<div id="loginBackground">

 

 

Any ideas would be welcome.

 

Thanks,
Haya

  • August 20, 2013
  • Like
  • 0

 

Hi Puja,

 

How can I enable 'Person Account' in my developer organization?

I believe, We can not log a case in Salesforce, when we are using FREE developer edition.

 

So, what is the way out??

 

-Kaity.

  • August 19, 2013
  • Like
  • 0

Hi,

     In a VF page there is a close button which should close the child window on click. The onclick event has window.top.close which works in desktops and laptops but the same is not working in  iPAD(OS/6.1.3). Any help to resolve this will be greatly appreciated.

 

 

 

  • August 19, 2013
  • Like
  • 0

I am getting an error while creating the project in eclipse kepler on Ubuntu linux machine. 

 

Error is Unable to create package manifest.

 

Exception: java.lang.ClassCastException:com.salesforce.ide.api.metadata.types.<etadata$JaxbAccessorF_fullName cannot be casr to com.sun.xml.internal.bind.v2.runtime.reflect.Accessor.

Hello,

In Salesforce, we have defined custom buttons (URL hack to pre-populate field values). It works great within Salesforce but does not in Community. We get an error:

 

https://xxxx.force.com/community/ is under construction

 

Here is the code for reference:

/500/e?&retURL=%2F{!Contact.Id}&RecordType=012i0000000Lmln&cancelURL=%2F{!Contact.Id}&CF00Ni0000002pfIH_lkid={!Contact.npo02__HouseholdId__c}&CF00Ni0000002pfIH={!Contact.npo02__Household__c}&cas3={!Contact.Name}&cas3_lkid={!Contact.Id}&00Ni0000001u0gR={!TODAY()}&cas4_lkid=001i000000CdAmtAAF&cas4=Individual

 

Interestingly enough it is working with the "old portal" but not in Community. Any idea on how to make this work or another possible solution to prepopulate a new record screen?

Thanks 

 

 

 

Opportunity opp = new Opportunity();
 opp.StageName = 'Closed Won';
 opp.Name = 'Testopp';
 opp.CloseDate = system.today();
  Insert opp;
       
List<OpportunityHistory> sd = [ SELECT Id, OpportunityId  FROM OpportunityHistory
                                                         WHERE OpportunityId = :opp.Id ];

 

In my Test Class, I had put this code and I run this code, I can able to get opportunity History record corresponding opportunity.

 

                                         

 

 

An error occurred while collecting items to be installed
session context was:(profile=epp.package.java, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=).
Problems downloading artifact: osgi.bundle,com.salesforce.ide.api,28.0.0.201307091110.
MD5 hash is not as expected. Expected: 2baf6bd485903f59fd75f64b02bba49a and found e138e1088b3201b173a475e12a200f2f.
Unable to read repository at http://www.adnsandbox.com/tools/ide/install/plugins/com.salesforce.ide.core_28.0.0.201307091110.jar.
Read timed out
Problems downloading artifact: osgi.bundle,com.salesforce.ide.documentation,28.0.0.201307091110.
MD5 hash is not as expected. Expected: 211b4c6b1b052b6f045a2ddab7727d5b and found 8d26c0441c4c93ac41a317b7aa7be269.
Problems downloading artifact: osgi.bundle,com.salesforce.ide.ui.editors,28.0.0.201307091110.
MD5 hash is not as expected. Expected: 6102b001cf5df768247999ec46f7113c and found bb87fca20333671e25a029a270de51e9.

Hi All,

 

I want to know if there is anyway to check wether the field is updated with certain value or not. I can track the changes if i set history track ON but i want to know if there is another way to check when the field value is updated by other user.

 

Thanks

 

  • August 13, 2013
  • Like
  • 0