• AsitM9
  • NEWBIE
  • 95 Points
  • Member since 2012

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 44
    Replies
Hey Guys,  I am getting this error in my simple Apex class: Illegal assignment from Schema.SObjectField to String at line 3 column 1

FYI - Opportunity.Description__c is a Long Rich text field.

____

Global with sharing class Job_Description_Transfer {

string htmlString = opportunity.Description__c;

String RegEx ='(</{0,1}[^>]+>)';
string result= htmlString.replaceAll(RegEx, '');



}

What am i doing wrong?

Thanks for your help!!

chad
I am new to using Rest services .I am trying to access Rally rest service (https://rally1.rallydev.com/slm/doc/webservice/) , i tried using :

HttpRequest req = new HttpRequest();
     req.setEndpoint('https://rally1.rallydev.com/slm/webservice/v2.0/task.js');
     req.setMethod('GET');
    
     // Specify the required user name and password to access the endpoint
     // As well as the header and header information

     String username = 'myname';
     String password = 'mypwd';
 
     Blob headerValue = Blob.valueOf(username + ':' + password);
     String authorizationHeader = 'BASIC ' +
     EncodingUtil.base64Encode(headerValue);
     req.setHeader('Authorization', authorizationHeader);
  
     // Create a new http object to send the request object
     // A response object is generated as a result of the request 
 
     Http http = new Http();
     HTTPResponse res = http.send(req);
     System.debug(res.getBody());


But it didnt work , i go a 401 response code back.
How do i get the security token and use it in my queries ? Has anyone integrated with Rally using Apex ?

Hi guys,

 

i need an urgent help with this

 

i have two picklist one Months in which there are twelve month {January febuarary,..so on} and another is years{2013,2014, to 2020}

i need to convert these two picklists to one date field can any one who wrote this function and share his code? i am in a lil bit hurry.

 

Thanks,

Ahmed

I have the force-wsc-27.0.0.jar from maven repo and wsdl file from my org.

I am trying to generate partner.jar using following command:

java -classpath force-wsc-29.0.0.jar com.sforce.ws.tools.wsdlc partener.wsdl  partenerNew.jar

Error :-

Exception in thread "main" java.lang.NoClassDefFoundError: org/stringtemplate/v4/STGroupDir
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2656)
        at java.lang.Class.getMethod0(Class.java:2897)
        at java.lang.Class.getMethod(Class.java:1739)
        at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.stringtemplate.v4.STGroupDir
        at java.net.URLClassLoader$1.run(URLClassLoader.java:359)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:348)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:347)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
        ... 6 more



please guide me..
thanks in advance.. 
  • March 04, 2014
  • Like
  • 0
Controller:

public class A
{
public string  s{get;set;};
	public A()
	{
		A= //some how i would like to store the value of s(java script varicble in this variable)
	}

}


VF page:

<apex:page controller="A">
	<script>
		var s;
		s='Value to be passed to apex class';
	</script>
</apex:page>

 http://boards.developerforce.com/t5/Visualforce-Development/How-to-store-javascript-variable-value-in-VFpage-controller/m-p/347637#M41881

 

given approach is not working for me.

plz suggest.

 

Hey Guys,  I am getting this error in my simple Apex class: Illegal assignment from Schema.SObjectField to String at line 3 column 1

FYI - Opportunity.Description__c is a Long Rich text field.

____

Global with sharing class Job_Description_Transfer {

string htmlString = opportunity.Description__c;

String RegEx ='(</{0,1}[^>]+>)';
string result= htmlString.replaceAll(RegEx, '');



}

What am i doing wrong?

Thanks for your help!!

chad
I am new to using Rest services .I am trying to access Rally rest service (https://rally1.rallydev.com/slm/doc/webservice/) , i tried using :

HttpRequest req = new HttpRequest();
     req.setEndpoint('https://rally1.rallydev.com/slm/webservice/v2.0/task.js');
     req.setMethod('GET');
    
     // Specify the required user name and password to access the endpoint
     // As well as the header and header information

     String username = 'myname';
     String password = 'mypwd';
 
     Blob headerValue = Blob.valueOf(username + ':' + password);
     String authorizationHeader = 'BASIC ' +
     EncodingUtil.base64Encode(headerValue);
     req.setHeader('Authorization', authorizationHeader);
  
     // Create a new http object to send the request object
     // A response object is generated as a result of the request 
 
     Http http = new Http();
     HTTPResponse res = http.send(req);
     System.debug(res.getBody());


But it didnt work , i go a 401 response code back.
How do i get the security token and use it in my queries ? Has anyone integrated with Rally using Apex ?
Does anyone know a any way to trigger authorize.net to automatically capture payment when order status changes to "shipped"?
We've integrated SF with authorize.net.  We'd like to automatically capture payment in authorize.net for an order that's had payment authorized, but not captured.  The trigger would be a change of status on the order, indicating that payment should be captured.  Is there any way to do this?  Manually capturing payment on each order is very tedious.
Hi All,

I need to migrate objects from one sandbox to other through eclipse IDE.
When i am trying to validate the deployment the following error comes.
Deploy Results:
   File Name:    objects/Customobject__c.object
   Full Name:  Customobject__c.xxxx
   Action:  NO ACTION
   Result:  FAILED
   Problem: In field: queue - no Queue named 'xxxx'found

I have not hardcoded the 'xxxx' quee anywhere.

Please help me in solving this issue.
I am new to apex, and have little java experience.

I am trying to setup a custom sort method for a custom object support__C
I would like to be able to first sort by a custom field titled Closed__c (this field allows a default value of checked or unchecked in a check box) more specifically... I would like to have the custom fields default value unchecked be listed first and checked to be below.

Then I would like to add a method that sorts both checked and unchecked lists by the date created.

The idea: if a topic is unchecked it is not closed, I want it at the top, but I also then want to sort all unchecked by date created.
then repeat the same for default value checked which would mean closed.

HI,

 

       I am working with custom soap webservice, from third party system i am getting date format is Nov 12,2013 how can i insert this date into salesforce.

 

 

i have two custom fields on user object 1. weekley count (number type)2. monthly count (number type). i want to set zero to the field weekley count on last day of week  at 00:00:00 and set zero to monthly count filed on last day of month at 00:00:00 hours

 

i have the possible solution is write a batch class and schedule the batch class at 00:00:00 hours.

 

does any other ways are there to achive this with out writing schedule class. like java script or any other ideas are appriciate.

 

Thanks,

Madhu

Hi dears,

 

Am getting err too many queries..Here attach my classes, Actually where do i write list collection please can anyone tel me...

public PageReference Save()
{
  
    /////////// LEVEL 1 ///////////////////
   List<level1s__c> selectLevel1 = new List<level1s__c>();
   List<level1s__c> selectedLevel1 = new List<level1s__c>(); 
   
   for(Level1sClass con: getList1Details())
    {
        system.debug('con'+con.selected);
        if(con.selected == true)
        {
            system.debug('firstCCCCCCCCCC:'+con.lev1);
            selectedLevel1.add(con.lev1);
        }
      
  
    Level1__c[] levl1= [Select Id from Level1__c where Account__c=: ApexPages.currentPage().getParameters().get('id')]; 
    delete levl1; 
    if(selectedLevel1 != null)
     { 
      for(level1s__c cCon: selectedLevel1)
        {
            system.debug('CCCCCCCCCC:'+cCon+'\n');
            string acctid =ApexPages.currentPage().getParameters().get('id');
            List<Level1__c> lvl1obj= new Level1__c[0];
            lvl1obj.add(new Level1__c(Name='Level1',Account__c=acctid,cLevel1__c=cCon.id));
            insert lvl1obj;
    
       
        }  
     }  
     /////////////// LEVEL 2 //////////////
   List<level2s__c> selectLevel2 = new List<level2s__c>();
   List<level2s__c> selectedLevel2 = new List<level2s__c>();
   
   for(Level2sClass con1 : getList2Details(con.lev1))
   
    {
        system.debug('con'+con.selected);
        if(con.selected == true)
        {
            system.debug('secondCCCCCCCCCC:'+con.lev2);
            selectedLevel2.add(con1.lev2);
        }
   
    }   
    Level2__c[] levl2= [Select Id from Level2__c where Account__c=: ApexPages.currentPage().getParameters().get('id')]; 
    delete levl2; 
    if(selectedLevel2 != null)
     { 
      for(level2s__c  cCon : selectedLevel2)
        {
        
         
            system.debug('CCCCCCCCCC:'+cCon+'\n');
            string acctid =ApexPages.currentPage().getParameters().get('id');
            List<Level2__c> lvl2obj= new Level2__c[0];
            lvl2obj.add(new Level2__c(Name='Level2',Account__c=acctid,cLevel2__c=cCon.id));
            insert lvl2obj;
    
        }  
     }  
    
    }
   
 return null;
}

 

 

Hey All,

 

I have a map 'm' <String,Decimal> with Values

 

{

 'abc',1000;

 'xyz', 200;

 'abc',100;

 'qwe',600;

 'qwe',800;

}

 

I need to add up the values if the key matches.  So the map should be like below after processing the above map

Abc and qwe are repeating, for them the values should be added. (abc: 1000+100 and qwe: 600+800)

 

{

'abc',1100;

'xyz', 200;

'qwe',1400;

}

 

How to achieve this?

All contacts from Account name =0017000000qz98bAAA with no case attched to them will be deleted

it is timing out

 

code for query is in following message

 

purge code not working in production but it is working in Full sandbox

 

 

 

 

 

SELECT Id FROM Contact WHERE CreatedDate <=:startDate  AND AccountId = '0017000000qz98bAAA' AND  id not in (select ContactId from Case) LIMIT 10000]

  • October 17, 2013
  • Like
  • 0

Is it possible to assign a record type with a visual force page.

I have this usecase,when i change owner to a particular type of user ,record type is updated. This record type should be associated with a page layout of minimum information. As i cannot take standard mandatory fields from a normal page layout,that wont work In short whenever i see this record,it should have only minimum information and should be associated with this particular minimum page Any ideas?

How can we split an address field(text area) into multiple lines. It shows in multiple lines. But when used in template will show all in one line.

 

Lets consider Billing Street. I am building a rich text area field where I need to display that field in a template. Now it is showing Billing Street in one line. I need to show them into mulitple lines.

 

I was using

String s = billingstreet.replaceAll('\r\n','<br/>');

String s = billingstreet.replaceAll('\n','<br/>');

 

Eg: 123 broad street <br/> headquarters of office

Even when i try this in rich text area its not displaying in seperate lines. Showing as same.

 

But nothing is working. Any Ideas!!!

Hi guys,

 

i need an urgent help with this

 

i have two picklist one Months in which there are twelve month {January febuarary,..so on} and another is years{2013,2014, to 2020}

i need to convert these two picklists to one date field can any one who wrote this function and share his code? i am in a lil bit hurry.

 

Thanks,

Ahmed

trigger AccountEntitlementUsedTrigger on Account_Entitlement_Used__c (after delete, after insert, after update) {
  if(Trigger.isDelete){
    List<id> LAcctID = new List<id>();
    for(Account_Entitlement_Used__c AE : Trigger.old){
      LAcctID.add(AE.Customer_Name__c);
    }
    List<Account> LAcctUpd = new List<Account>();
    for(Account Acct : [Select id, Current_Balance_CRA__c, Current_Balance_Miele__c, Current_Balance_Partner__c,Total_Partner_Event_Balance__c, Total_Miele_Event_Balance__c,Total_CRA_Balance__c
      from Account where id IN :LAcctID]){
     Acct.Current_Balance_Partner__c = BenefitCalculation.countEntitlementNumber(Acct.id,'Partner Events', date.today())[3];
     Acct.Current_Balance_Miele__c = BenefitCalculation.countEntitlementNumber(Acct.id,'Miele Events', date.today())[3];
      Acct.Current_Balance_CRA__c = BenefitCalculation.countEntitlementNumber(Acct.id,'CRA Services', date.today())[3];
         
       
    //List<String> LType = new String[]{'CRA Services','Miele Events','Partner Events'};
     //  List<integer> HType = new integer[]{0,0,0};
     //  for(Integer i = 0; i < 3; i++){
     //  HType[i]=BenefitCalculation.countEntitlementNumber(Acct.id,LType[i], date.today())[4];
       
       
  //Acct.Total_CRA_Balance__c=HType[0];  
 //Acct.Total_Partner_Event_Balance__c =HType[1];
// Acct.Total_Miele_Event_Balance__c = HType[2];

    //   }
      

  
 

      LAcctUpd.add(Acct);
    }
    if(LAcctUpd != null && LAcctUpd.size()>0)
      update LAcctUpd;
      
      
    //////////////////////////  
      
    List<Account_Entitlement__c> LAcctUpdd = new List<Account_Entitlement__c>();
    for(Account_Entitlement__c Acctt : [Select id from Account_Entitlement__c where id IN :LAcctID]){
      Acctt.Related_Entitlement_Used__c='';
      LAcctUpdd.add(Acctt);
    }
    if(LAcctUpdd != null && LAcctUpdd.size()>0)
      update LAcctUpdd;
  
  }
  else if(Trigger.isUpdate){
    
 List<id> LAcctID = new List<id>();
  for(Account_Entitlement_Used__c AE : Trigger.new){
    LAcctID.add(AE.Customer_Name__c);
  }
 List<Account> LAcctUpd = new List<Account>();
 for(Account Acct : [Select id, Current_Balance_CRA__c, Current_Balance_Miele__c, Current_Balance_Partner__c ,Total_Partner_Event_Balance__c, Total_Miele_Event_Balance__c,Total_CRA_Balance__c
     from Account where id IN :LAcctID]){
   Acct.Current_Balance_Partner__c = BenefitCalculation.countEntitlementNumber(Acct.id,'Partner Events', date.today())[3];
     Acct.Current_Balance_Miele__c = BenefitCalculation.countEntitlementNumber(Acct.id,'Miele Events', date.today())[3];
     Acct.Current_Balance_CRA__c = BenefitCalculation.countEntitlementNumber(Acct.id,'CRA Services', date.today())[3];
           
       
   // List<String> LType = new String[]{'CRA Services','Miele Events','Partner Events'};
     //  List<integer> HType = new integer[]{0,0,0};
     //  for(Integer i = 0; i < 3; i++){
    //   HType[i]=BenefitCalculation.countEntitlementNumber(Acct.id,LType[i], date.today())[4];
       
       
 // Acct.Total_CRA_Balance__c=HType[0];  
 //Acct.Total_Partner_Event_Balance__c =HType[1];
 //Acct.Total_Miele_Event_Balance__c = HType[2];

       //}

      LAcctUpd.add(Acct);
 }
  if(LAcctUpd != null && LAcctUpd.size()>0)
    update LAcctUpd;
    
 }
    else if(Trigger.isInsert){
      string abc;
    Set<String> Sname= new Set<String>();
    List<id> LAcctID = new List<id>();
    for(Account_Entitlement_Used__c AE : Trigger.new){
      LAcctID.add(AE.Customer_Name__c);
      Sname.add(AE.Entitlement_Type__c);
   abc=AE.id;
    }
    

    
    
    List<Account> LAcctUpd = new List<Account>();
    for(Account Acct : [Select id, Current_Balance_CRA__c, Current_Balance_Miele__c, Current_Balance_Partner__c ,Total_CRA_Balance__c,Total_Miele_Event_Balance__c,Total_Partner_Event_Balance__c
      from Account where id IN :LAcctID]){
     Acct.Current_Balance_Partner__c = BenefitCalculation.countEntitlementNumber(Acct.id,'Partner Events', date.today())[3];
      Acct.Current_Balance_Miele__c = BenefitCalculation.countEntitlementNumber(Acct.id,'Miele Events', date.today())[3];
   Acct.Current_Balance_CRA__c = BenefitCalculation.countEntitlementNumber(Acct.id,'CRA Services', date.today())[3];
     
      
       
    //List<String> LType = new String[]{'CRA Services','Miele Events','Partner Events'};
    //   List<integer> HType = new integer[]{0,0,0};
     //  for(Integer i = 0; i < 3; i++){
     //  HType[i]=BenefitCalculation.countEntitlementNumber(Acct.id,LType[i], date.today())[4];
       
       
 // Acct.Total_CRA_Balance__c=HType[0];  
// Acct.Total_Partner_Event_Balance__c =HType[1];
// Acct.Total_Miele_Event_Balance__c = HType[2];

     //  }
      LAcctUpd.add(Acct);
    }
    if(LAcctUpd != null && LAcctUpd.size()>0)
      update LAcctUpd;
      
       
    List<Account_Entitlement__c> LAcctUpdd = new List<Account_Entitlement__c>();
    for(Account_Entitlement__c Acctt : [Select Customer_Name__c from Account_Entitlement__c where Customer_Name__c IN :LAcctID and Expired__c=false and Related_Entitlement_Used__c=null and Entitlement_Type__c IN :Sname  order by Id asc limit 1]){

      
      
        Acctt.Related_Entitlement_Used__c=abc;
        LAcctUpdd.add(Acctt);
   
    }
    if(LAcctUpdd != null && LAcctUpdd.size()>0)
      update LAcctUpdd;
   

      

  }



}

  • July 25, 2013
  • Like
  • 0

Hi there,

 

I have 2 redordtypes with picklist values , when vf1 page loads i need to diplay recordtype1 picklist values as dropdown and if when vf2 page loads i need to diplay recordtype2 picklist values as dropdown.

 

any one please suggest me how to get the picklist values of record type and display on visualforce page.

 

Thanks

 

When do we use __r? 

 

Can we use __r both in Parent Object and in custom object?

 

-Kaity

  • July 22, 2013
  • Like
  • 0

Hi All,

 

I am opening one VF page on click of edit fo lis view of particular object. Now I want to get the id of that particular record which I edited. I am writing this code but its throwing this error.

 

Cyclical server-side forwards detected: /apex/CasePopulate

 

VF Code

<apex:page standardController="Case_Accession__c" extensions="ExtentionController1" action="{!pageredir}"  >
    <apex:form >
    <apex:pageBlock >
     <!-- Begin Default Content REMOVE THIS -->
  <h1>Congratulations</h1>
  This is your new Page
  <!-- End Default Content REMOVE THIS -->
 <apex:inputText value="{!TestEditSpecimenID }"/>
    </apex:pageBlock>
      </apex:form>
 </apex:page>

 

Apex Code

 

public class ExtentionController1
 {
         public String var {get;set;}
         public string TestEditSpecimenID {get;set;}
     public ExtentionController1(ApexPages.StandardController controller)
     {}
     public Pagereference pageredir()
     {
      var= ApexPages.currentPage().getParameters().get('Id');
           if(var!=null)
           {
             TestEditSpecimenID = var;
             Pagereference newpage = new Pagereference ('/apex/CasePopulate');
              //Pagereference newpage =Page.Accession;
            return newpage;
           }
            else
           {
             //Pagereference newpage =Page.Accession;
             return null;
           }
     }
 }

 

 

One more thing please I want to show the ID of reord into " <apex:inputText value="{!TestEditSpecimenID }"/> "

 

Thanks in advance
Raman

 

 

I have created an opportunity trigger to send out an email to two separate email address field whenever the stage is Closed Won depending on the Campaign Type. It works perfectly fine but recently when I tried updating a list of 200 opportunity records it gave me an error saying "**Too many code statements 200001**".

 

My code is as follows:

 

trigger SendEmail on Opportunity (after update)
{
Set<Id> accountSet = new Set<Id>();
Set<Id> marketSet = new Set<Id>();

for (Opportunity o : Trigger.new) {
accountSet.add(o.Accountid);
marketSet.add(o.Campaignid);
}
Map<Id, Account> accountMap = new Map<Id, Account>([SELECT Name, Phone, PersonMobilePhone, PersonEmail from Account where id in :accountSet] );
map<Id, Campaign> marketMap = new Map<Id, Campaign>([SELECT Name, Parent_Market__c from Campaign where id in :marketSet]); 
for (Opportunity o : Trigger.new) {
if(o.Campaign_Type__c != Null && o.StageName != Null){
for (Integer i = 0; i < Trigger.old.size(); i++) {
Opportunity old = Trigger.old[i];
Opportunity nw = Trigger.new[i];
Account theAccount = accountMap.get(o.AccountId);
Campaign Market = marketMap.get(o.CampaignId);
String userName = UserInfo.getUserName();

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); 
List<String> toAddresses = new List<String>();
List<String> ccAddresses = new List<String>();
ccAddresses.add('test@test.com');
mail.setToAddresses(toAddresses); 
mail.setCcAddresses(ccAddresses);
mail.setSenderDisplayName('Campaign Information');

mail.setSubject(+ theAccount.Name + ' is Closed Won');

mail.setReplyTo('noreply@salesforce.com');
//Body of the Email
mail.setHtmlBody(
'<font face="Times" size="3">'+
'<table width="100%">'+
'<tr width="0%">'+
'<td rowspan="0">'+
'</td>'+
'<td>'+
'<h2>Account is closed won notification</h2>'+
'</td>'+
'</tr>'+
'</table>'+
'<br/>'+
'<b>Stage:</b> ' + o.StageName + '<br/>' + '<br/>' +
'<b>Opportunity Number:</b> ' + o.Name + '<br/>' +
'<b>Amount Paid:</b> $' + o.Amount + '<br/>' + '<br/>' +
'<b>Account Name:</b> ' + theAccount.Name + '<br/>' +
'<b>Phone:</b> ' + theAccount.Phone + '<br/>' +
'<b>Mobile:</b> ' + theAccount.PersonMobilePhone + '<br/>'+
'<b>Email:</b> ' + theAccount.PersonEmail + '<br/>'+
);

// Send Email if it isCampaign1 and Closed Won
if((nw.StageName !=old.StageName) || (nw.Campaign_Type__c !=old.Campaign_Type__c)){ 
if(o.Campaign_Type__c.equals('Campaign1')){
if(o.StageName.equals('Closed Won') ){
toAddresses.add(o.Email__c);
try {
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
catch(Exception ex) { }
}

}
}
// Send Email if it is Campaign2 and Closed Won
if((nw.StageName !=old.StageName) || (nw.Campaign_Type__c !=old.Campaign_Type__c)){ 
if(o.Campaign_Type__c.equals('Campaign2')){
if(o.StageName.equals('Closed Won')){
toAddresses.add(o.Email2__c);
toAddresses.add(o.Email1__c);
try {
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
catch(Exception ex) { }
}
}
} 
} 
}
} 
}

 

Any help would be appreciated.

Thanks

I am not geeting the Visual force page in to override with List of an Custom object. I  Changed my VF page like this

 

<apex:page standardController="Case_Accession__c"  extensions="ExtentionController">

...................My Code..............................

</apex:page>

 

What I am doing wrong ??

 

Regards

Raman