• Pramod_SFDC
  • NEWBIE
  • 233 Points
  • Member since 2014

  • Chatter
    Feed
  • 8
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 0
    Questions
  • 97
    Replies
Hi folks,
    Can anyone tell me what is the difference between Partner Community and Cutomer Community?
What are the features available in Partner Community and Customer Community


Thanks in advance
Karthick
I'm attempting to find the "first" selected value in a multi-select picklist, and pass it into another field. I thought it would be fairly simple to do this - just take the string that the multi-select gets stored as, find the position of the first semicolon using indexof, then take everything before it using substring(0,firstsemicolon). And it works... sorta. The result is a single value from the selected values. But it's not the first value. To troubleshoot, I removed the indexof and substring and just wrote the value of the multi-select straight into the other field. So now I've got:

public class CaseFirstSymptom{
    public static void Symptoms (Case[] SymptomCases){
        for( Case SymptomCase : SymptomCases) {
            string FirstSymptom = SymptomCase.Symptoms__c;
            SymptomCase.First_Symptom__c = FirstSymptom;
        }
    }
}
On a record, I select the following values, and see this string displayed for that field after saving:
Complete (Pilot & Burner) Outage; Delayed Ignition; Does Not Light; Flare-Ups/Uneven Heat; Low Heat/Low Flame; Outage; Pressure Not Changing

The "target" field winds up displaying this:
Delayed Ignition;Complete (Pilot & Burner) Outage;Pressure Not Changing;Low Heat/Low Flame;Does Not Light;Outage;Flare-Ups/Uneven Heat

The values are all the same, but the order is changed.

I've got the picklist values in alphabetical order. I'm wondering if the values are ordered by ID or something though when you use that field in Apex. Anyone know for sure? And if so, anyone know a way around this?
We have a "edit" and "view" VF page for Cases.  They work fantastic for creating new records and viewing them, but once we select the "Edit" button, change values, and select "Save", it doesn't save our changes.

Any initial thoughts on what we need to change to the VF pages?
Also, the user we're testing with has full access to Cases.
Thanks!
Hi All,

I have a visualforce page which overrides the new button for creating new record. It performs data validation and rerenders the page if something is wrong. I am trying to use same controller extension from a custom button as well. but when I add the visual force page in my button I get following error:

SObject row was retrieved via SOQL without querying the requested field:

A lot of people suggested to set rendered = false on the page but that does not meet my requirement as I need to get those fields in edit mode to perform similar action as I did when creating the record.

Any suggestions would be greatly appreciated.
Hello

How do I create a test class to test sending email and create a document?
Unit test - method newPublier

global class AAAA implements System.Schedulable {
global String str{get;set;}
global String mail{get;set;}
global String nomJob{get;set;}
global String inputText{get;set;}
global String heure{get;set;}
global String minute{get;set;}
global String jourMois{get;set;}
global String mois{get;set;}
global String jourSemaine{get;set;}

global void execute(SchedulableContext sc) {
  newPublier();
}

global AAAA () {

}

global AAAA (String mail, String inputText, String heure, String minute, String jourMois, String mois, String jourSemaine) {
this.mail= mail;
this.inputText = inputText;
this.heure= heure;
this.minute= minute;
this.jourMois= jourMois;
this.mois= mois;
this.jourSemaine= jourSemaine;
}

public void setMail(String mail) {
    this.mail= mail;
}

public String getMail() {
    return mail;
}

public void setRequete(String inputText) {
    this.inputText= inputText;
}

public String getRequete() {
    return inputText;
}

public void setHeure(String heure) {
    this.heure= heure;
}

public String getHeure() {
    return heure;
}

public void setMinute(String minute) {
    this.minute= minute;
}

public String getMinute() {
    return minute;
}

public void setJourMois(String jourMois) {
    this.jourMois= jourMois;
}

public String getJourMois() {
    return jourMois;
}

public void setMois(String mois) {
    this.mois= mois;
}

public String getMois() {
    return mois;
}

public void setJourSemaine(String jourSemaine) {
    this.jourSemaine= jourSemaine;
}

public String getJourSemaine() {
    return jourSemaine;
}


public void schedulejob(){
        String aaa = getMail();
        String req = getRequete();
        String heu = getHeure();
        String min = getMinute();
        String jMois = getJourMois();
        String leMois = getMois();
        String jSemaine = getJourSemaine();
                
        String NomJobSchedulable = nomJob;
        AAAA p = new AAAA (aaa, req, heu, min, jMois, leMois,jSemaine);
        String sch = '0'+' '+min+' '+heu+' '+jMois+' '+leMois+' '+jSemaine;
 
        system.schedule(NomJobSchedulable , sch, p);   
}

public void newPublier(){

    String query=inputText;
    String premier=query.substringAfter('select ');   
    premier=  premier.substringBefore('from');
      
    string titre= premier+'\n';
    string contenuCSV = titre;

    string queryResultatString = '';

    list<sObject> queryResultat = (List<sObject>)database.query(inputText);
    for(sObject a: queryResultat)
    {

        queryResultatString = queryResultatString + string.valueof(a);
        
    }
    System.debug('Query result string:'+queryResultatString);

    list<string> queryLignes = queryResultatString.split('}');

    for(string s:queryLignes){
        list<string> queryColonnes = s.split(',');
        for(string st:queryColonnes){
            contenuCSV = contenuCSV + st.substringAfter('=') + ',';
        }

        contenuCSV = contenuCSV.substringBeforeLast(',').substringBeforeLast(',') + '\n';
    }

    String lignes = contenuCSV;
    List<String> parts = lignes.split('\n');
    integer lineNumber = queryResultat.size();

    integer nbLignesPJ = 1000;
    integer compterParties=0;

    for(integer i=0;i<lineNumber;i++){

      string fichierParties = parts[0] + '\n';

      if(math.mod(i,nbLignesPJ)<>0) continue;
      if((lineNumber-i)<nbLignesPJ){

        for(integer j=1;j<=(lineNumber-i);j++){
            fichierParties = fichierParties + parts[i+j] + '\n';
        }
      }
      if((lineNumber-i)>=nbLignesPJ){
         for(integer j=1;j<=nbLignesPJ;j++){
            fichierParties = fichierParties + parts[i+j] + '\n';
        }
      }
      //Envoyer le Mail
      Messaging.EmailFileAttachment csvPJ = new Messaging.EmailFileAttachment();
      blob csvBlob = Blob.valueOf(fichierParties);
      string csvNom = 'cases_fermes_'+Date.today().format()+'.csv';
      csvPJ.setFileName(csvNom);
      csvPJ.setBody(csvBlob);
      Messaging.SingleEmailMessage email =new Messaging.SingleEmailMessage();
      String[] adressMail = new list<string> {mail};
      compterParties++;
      String subject;
          subject = 'CSV - '+Date.today().format();
      email.setSubject(subject);
      email.setToAddresses(adressMail);
      email.setPlainTextBody('message');   
      email.setFileAttachments(new Messaging.EmailFileAttachment[]{csvPJ});
      Messaging.SendEmailResult [] envoyer = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
    }
  }   
}

I signed up a partner developer editon just now, and the first thing I did after I logged into this new org was to create a simple "HelloWorld" VF page ...
<apex:page >
  <!-- Begin Default Content REMOVE THIS -->
  <h1>Hello World</h1>
  This is your new Page
  <!-- End Default Content REMOVE THIS -->
</apex:page>

After I clicked on the "Preview" button, the URL in the borwser first showed "https://na17.salesforce.com/apex/HelloWorld" then it got immediatedly changed to "https://c.na17.visual.force.com/visualforce/recsession?sid=00Do0000000KCZ9%21AQYAQCEqUDGvlEz9kvuEQ4LyI6RQXlxqEOWOOAVcCniuBtIkP3cfmcY4IH0qz2Ee.vcLJ3KLNPUUl0bgbYzQzsJXf.wiaOpb&inst=o&cshc=0000000qCMx0000000KCZ9&retURL=https%3A%2F%2Fc.na17.visual.force.com%2Fapex%2FHelloWorld"

which took me to a blank page.

I've tried to clear the browser cache and used a few different browsers to bring up this simple vf page, the end result was the same. Not sure what happened, please help. 

Hi, I'm having an issue in Summer 14' organization that I had never seen. When I try to access a Visualforce Page like I usually do, I get a blank page.


For example, If I try:

https://virtualseller-6602.cloudforce.com/apex/testVF

I get:

https://virtualseller-6602--c.na17.visual.force.com/visualforce/recsession?sid=00Do0000000K6Rm!AXftXXXXXXXXJcxkUqKgCyAJeBmZzgMXTYBMp0KkIDAgbUtzLBRv2J18hTjc4qTS4RU2D9XtlyeOtUl1sT3Stb712h7h&inst=o&cshc=0000000O8H60000000K6Rm&retURL=https%3A%2F%2Fvirtualseller-6602--c.na17.visual.force.com%2Fapex%2FtestVF

And stops there.
It seems that something goes wrong with the session validation and I don't know why. It's happening with ALL the Visualforce Pages of the org.

Is anyone having the same problem/issue?
Thanks

Hello,

How do I update the CronTrigger table after deleting a JOB schedulable and recreate it?
I want to update informing the last date of execution (PreviousFireTime).

How do I do this?
Thank you
I am doing a simple query on custom object like below:

SELECT Widget__c.Name,  Id, orderid__c, (SELECT Model__c.Name FROM Widget__c.Models__r) FROM Widget__c order by orderid__c

orderid__c is a numeric field, used to sort.
it works fine in the developer console query editor, but doesn't appear in ordered form in the code.

any help would be great!!!


Thanks,


  • September 03, 2014
  • Like
  • 0
Hi ,

Can anybody help me in acheiveing this scnario . I need a link on top of the account page out. when clicked it will go to another web page.
User-added image
  • September 03, 2014
  • Like
  • 0
Hello,

I am trying to insert price book enty in test class.When i have inserted this and run that class it worked fine. But My so may test class is using price book.As i ran all the test class by clicking "Run All Test"  It is giving error

"System.DmlException: Insert failed. First exception on row 0; first error: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record: []"
How canm i solve this granulatity issue.

My code is this

Id pricebookId = Test.getStandardPricebookId();
     
        PricebookEntry standardPrice = new PricebookEntry(
             Pricebook2Id = pricebookId, Product2Id = objProduct.Id,
             UnitPrice = 10000, IsActive = true);
        insert standardPrice;
       
        // Create a custom price book
        Pricebook2 customPB = new Pricebook2(Name='Custom Pricebook', isActive=true);
        insert customPB;
       
        // 2. Insert a price book entry with a custom price.
        PricebookEntry customPrice = new PricebookEntry(
            Pricebook2Id = customPB.Id, Product2Id = objProduct.Id,
            UnitPrice = 12000, IsActive = true);
        insert customPrice;
  • September 03, 2014
  • Like
  • 0
Hi folks,
    Can anyone tell me what is the difference between Partner Community and Cutomer Community?
What are the features available in Partner Community and Customer Community


Thanks in advance
Karthick
How can I create a single row object in salesforce?

In oracle, I could do something like this for a single row table:

create table singlerowtable(lastrundate DATE);

create unique index singlerowtable_uk ON singlerowtable('1');

Hi folks,
          Can anyone tell me whats prupose of customer community login license and how they difffer from customer community license


Thanks in advance
Karthick

Hi,

What is the significance of-   trigger.newMap.keySet()?

Opportunity i=[select ownerid, id,Owner.manager.email,Owner.manager.name from opportunity where id=:trigger.newMap.keySet()];

Thanks 
Kaity
  • September 01, 2014
  • Like
  • 0
Hi,

I am planning to give salesforce certification of dev401,
Could any one please provide me latest dumps.

Thanks in advance.
Hello,

I am newhere and I'm trying to develop a page that receive a record id of a custom object check if a record with this id exsist, if not creat one.
can anyone show how to do it.

Thanks

Hi,

I am trying to test out the email limit for Developer and Enterprise edition on SingleEmailObject using Apex Code. I have followed these guidlines for email limit : https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_gov_limits.htm

Here they have mentioned that if sending email using "setTargetObjectId" is not going to be counted for internal users. When i try to test it i made requests multiple times to send out the email. For the 1 developer edition account total of 23 emails came and for other developer edition account 27 emails came. After that i am not getting any exception from Apex code. No SINGLE_EMAIL_LIMIT_EXCEPTION . but  the emails are also not coming.

I have also tried the same for Enterprise ORG and got 14 emails only. After that no exception and no email either.

Does anyone knows any of the facts that weather there is any 1 hour milit or something like that?

I'm trying to send a SOQL query to the Tooling API (Soap version) to bring back the ApexExecutionOverlayResult records.

If I send the query:
Select Id, HeapDump from ApexExecutionOverlayResult

I get the result:
UNKNOWN_EXCEPTION: An unexpected error occurred. Please include this ErrorId if you contact support: 1377859780-46461 (1693774395)

The same issue occurs if I include any of these fields (which are typically the most interesting fields in the checkpoint output):
  • HeapDump,
  • ApexResult,
  • SOQLResult
Running the same query in the developer console against the Tooling API gives the same errors.
I wrote some apex and would like to write a test for it, but am stumped as to how to do it!

The code to be tested is an apex "after update" trigger that schedules some apex code to run in 2 seconds, and this code in turn starts a batch job.  The job runs execute() and finish(), and I want my test code to verify that the execute() and finish() did the right the right things.

The test code is like this:
<create records>
Test.startTest();
update acct;
Test.stopTest();
<asserts that the execute and finish code did the right things>

But, through use of logging, I see that the scheduled apex code ran fine, and started the batch job, but the execute() and finish() code happens after my asserts and the test routine finishes!   This is not at all what I expected would happen from reading the documentation.  It is good (for coverage) that the code runs, but m test is not able to assert that the code worked.

I cannot figure out how to write the test to verify that the actions the trigger did, including running the batch job, worked correctly. 

The only thing I can think of is to write a separate test simulating the scheduled apex code itself.

Anyone else have any ideas?

Thanks, Dave
Hi,

We have 2 scheduled jobs which are executing hourly basis in our app. In few of our client's org, they stopped executing unexpectedly.

They are shown in Setup->Monitoring->Scheduled Jobs

But, the next scheduled run of both the jobs is null.

What can be the reason of this kind of behavior?

Thanks,
Rupali
Hi 
i have created this simple trigger but i don't know how to do a test class.
please help me, it looks simple trigger and i suppose that is a simple test class.

trigger Block_Unblock_RejectionsTriger on QA_Order_Control__c (before insert,before update) {


for (QA_Order_Control__c objqaoc : Trigger.new)

{
if  (objqaoc.Reject_team__c!=null  )

   {
    objqaoc.Was_Created__c= true;
   
     }
   else {
    objqaoc.Was_Created__c= false;
         }
}


I'm getting this error while i'm running my test class. I have a webservice class which will send sms when i insert a new record or if i update a an existing record

Here are my webservice class, trigger which is invoking webservice call and test class for both class & trigger.

Web Service call

public class CreatingAccountsendsms { 
@Future(callout=true)
    public static void Creating_Lead(string mobile,string leadname,string Uname,string UMobilePhone) {
    
   // list<account> acc=[SELECT Id,Phone FROM Account where id=:conId];
    
                  String Username ='management@abc.com';
                  String Password = '321@admin';
                  String TempID='21341';
                  String MobileNo=mobile;
                  String SenderID = 'ABC';
                  String F1= leadname;
                  String F3= Uname;
                  String F2= UMobilePhone;
                  String F4= '';
       String postData = 'username=' +Username + '&pass=' + Password + '&dest_mobileno=' + MobileNo +'&senderid=' + SenderID + '&tempid=' + TempID+'&F1=' + F1+ '&F2=' + F2+ '&F3=' + F3+'&F4=' + F4;
       
       HttpRequest req = new HttpRequest();
    req.setEndpoint('http://123.01.01.01/blank/sms/user/urlsmstemp.php?'+postdata);
    req.setMethod('GET');
    system.debug(req);
    Http h = new Http();
    HttpResponse res = h.send(req);
    
    //system.debug(res);
    //return res;
    } 

     @Future(callout=true)
    public static void CreatingAccountsendsms1(string mobile,string leadname,string Uname,string UMobilePhone) {
   
   // list<account> acc=[SELECT Id,Phone FROM Account where id=:conId];
   
                  String Username ='management@ABC.com';
                  String Password = '321@admin';
                  String TempID='21342';
                  String MobileNo=mobile;
                  String SenderID = 'ABC';
                  String F1= leadname;
                  String F2= Uname;
                  String F3= UMobilePhone;
                  String F4= 'creatorname';
       String postData = 'username=' +Username + '&pass=' + Password + '&dest_mobileno=' + MobileNo +'&senderid=' + SenderID + '&tempid=' + TempID+'&F1=' + F1+ '&F2=' + F2+ '&F3=' + F3+'&F4=' + F4;
      
       HttpRequest req = new HttpRequest();
    req.setEndpoint('http://123.01.01.01/blank/sms/user/urlsmstemp.php?'+postdata);
    req.setMethod('GET');
    system.debug(req);
    Http h = new Http();
    HttpResponse res = h.send(req);
   
    //system.debug(res);
    //return res;
    }

}

Trigger to invoke my webservice method

trigger sms on Account (after insert,after update) {


for(Account acc:trigger.new)
{
user u=[SELECT Alias,Id,MobilePhone,Name,Phone,ProfileId FROM User where Id=:acc.OwnerId];
Profile p = [SELECT id,Name FROM Profile WHERE Id = :u.profileid];
system.debug('@@@@@@@@@+++++++++++++++++++++++++++++++++++++++++++++++++++++='+p.name);


if(trigger.isafter){
 CreatingAccountsendsms.Creating_Lead(acc.PersonMobilePhone,acc.Lastname,u.name,u.phone);
}
if(trigger.isupdate)
{
user u1=[SELECT Alias,Id,MobilePhone,Name,Phone FROM User where Id=:acc.CreatedById];
if(acc.ownerid != trigger.oldmap.get(acc.id).ownerid )
{
if(p.name=='SPU - Sales Manager' || p.name=='Unishire Sales Profile' || p.name=='Channel Sales Manager')
{
system.debug('@@@@@@@@@+++++++++++++++++++++++++++++++++++++++++++++++++++++='+p.name);
 sendsms.sendsms1(u.MobilePhone,u.name,acc.Lastname,acc.PersonMobilePhone,acc.Project_Interested__c,u1.name);
 CreatingAccountsendsms.CreatingAccountsendsms1(acc.PersonMobilePhone,acc.Lastname,u.name,u.MobilePhone);
 //acc.name=u.Lastname;
//sendsms.sendsms1(acc.Phone1__c,acc.name);
}
}
}
}
}

the above class and trigeer is for Account object and I have same kind of class and trigger for Debit Note also. 

In my test class if i just insert account test method will be passed if i insert new debit note record along with account then i'm getting this callout exception

Error Message : System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out
Stack Trace  :  Class.CreatingAccountsendsms.Creating_Lead: line 50, column 1

Here is my test class

@isTest(SeeAllData=true)
public class new_test_class1{
    @isTest static void Test_lead(){
        
        Account acc= new Account(); 
        acc.name='Acc1';
        acc.Status__c='new';
        acc.Custom_AN__c=1;
        acc.Project_Interested__c='atrium';
        acc.Phone1__c='8015825819';
        acc.Email__c='samdbinu@gmail.com';
        insert acc;
        
        Debit_Note__c DN = new Debit_Note__c();
        DN.Name = 'test';
        DN.Account__c = acc.id;
        insert DN;
        
        
                
        Test.startTest();
         Test.setMock(HttpCalloutMock.class, new Stubby());
         string mobile = '12345';
         string name = 'Sharat';
         string status = 'done';
         string dateon = '1/1/2014';
         string Uname = 'New';
         string Umobile = '90086573';
         string leadname = 'Test';
         string UMobilePhone = '90087345';
        
         CreatingAccountsendsms.CreatingAccountsendsms1(mobile,leadname,Uname,UMobilePhone);
        Test.StopTest();
    }
}



Hi,

As a complete new user, I've a few basic, I think, questions regarding importing data from Maximizer, which I've exported to an CSV file.

I only need to create three new Contact fields:
Priorty (1=Very Interested; 2=Moderate Interest, etc.)
Contact Type (Art Gallery, Photo Gallery, and about 20 others)
Coorespondence (Email Blast 2014, Postcard Mailed 2013, etc.)

I think I understand how to create the fields in Build>Contacts>Fields but I dont know how to have the  fields populated with items imported from Maximizer, rather than add them manually.

Any suggestions would be helpful!

Thanks, Steve

 

EXCEPTION: System.CalloutException: Web service callout failed: Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found ':HTML'.

I have generated the Apex classes from the WSDL.

when i am trying to execute anonymous log the above exception comes.

FYI here the endpoint in the remote settings is pointed to 'Intranet'.

Please let me know how to sove and any work arounds..

Thanks