• Emmanuel B.
  • NEWBIE
  • 25 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 13
    Replies

Hi,

I have made a worflow rule to send an email to a user when he is late in one step of a program.

The Rule Criteria is
(MyStepObject: Status not equal to Complete) and (ProgramObject: Status not equal to Timed out) and (MyStepObject: FieldToUpdate not equal to null) and (ProgramObject: EndDate greater or equal TODAY)

When the record meets the criteria (typically when it's created), it creates Time-Dependent Workflow Action 21 Days After MyStepObject: EndDate who updates a field, so that a trigger is run and the email is sent to the user. (it creates in fact after 1 , 7 , 14 and 21 days).

Let's consider that the rule is run when the Step record is created, on october 1st, with Step.EndDate = oct 11 and Program.EndDate=oct 31
A field update is scheduled 21 days after oct 11, which is nov 01
I assumed that since there's in the criteria "ProgramObject: EndDate greater or equal TODAY" this action would not have been done because the criteria would have been tested again before it ran, and TODAY(nov01) < Program.EndDate(oct31)

However, the field was updated on nov 01 at 23:00 (and the mail sent).

Can anyone explain me why ?

Thanks for your help

Hi all,

I want to update the contact's mail address when the user changes its mail address in Communities.
I have written a trigger but it's not triggered when only the email is changed, probably because the change requires a confirmation (by mail) andis then made via the setup/emailverif page who, I guess, must call special methods, or maybe run with a guest user without any right ?

I have tried to trigger a workflow as well, but same : if I modify the email address from the setup/user interface in salesforce, the workflow (and trigger) is run, but if I modify via Communities -> /setup/emailverif, nothing happens.

Any idea how to fix it, or even to debug it (no debug is available for the emailverif call, maybe because it's run with a guest user I can't add to the usres watched)

Thanks for any answer
Hello,

Here's the scenario : one active community, one account, two contacts. The 2 contacts have the same email address. You want to create a community user for contact One, it associates with contact Two.

Code in CommunitiesSelRegController, called by a commandButton in apex page :

public void test()
    {
        Account a = new Account(Name='Account test', OwnerId='005A0000001fgpe' ); //Owner = me, must have a role
        insert a;
       
        List<Contact> lc = new list<Contact>{
                new Contact(LastName='One', email='same@mail.com', AccountId=a.Id),
                new Contact(LastName='Two', email='same@mail.com', AccountId=a.Id),
                new Contact(LastName='Three', email='different@mail.com', AccountId=a.Id)
                    };
        insert lc;
       
        User u = new User();
        u.userName = lc[1].email;
        u.email = lc[1].email;
        u.FirstName = 'test';   
        u.LastName = lc[1].LastName;
        u.alias = 'watvr';
        u.CommunityNickName=u.alias;
        u.ProfileId = '00eA0000000yex2'; //Customer community user profile
        u.ContactId = lc[1].Id;
         u.CompanyName = a.Name;
        system.debug(u);     // will output User:{ ...ContactId = Two.Id ...}
        String userId = Site.createPortalUser(u, a.Id, null, true);
        system.debug(u);// will output User:{ ...ContactId = One.Id ...}
        }

Don't know where to report this bug...

Hi,

I have a custom field where is stored a 15 digits Id.
I need to build a String csv with the 18 digits version of this Id.
In my Execute anonymous window, I tried a simple

system.debug(Id.valueOf('101c00000001GWe'));

 


and got

USER_DEBUG|[2]|DEBUG|101c00000001GWeAAM

 


Wonderful, that's what I need !  But when I try to write in my class

csv += Id.valueOf(var);

 


I get an ugly

Save error: variable does not exist: Id

 



I finally did what I need by creating a variable with

Id myId = String.valueOf(var); 
csv += myId;

 


But I don't understand why the documented static method Id.valueOf works in anonymous code and not in a class ?

 

Hello,

I have tried to find a reference for the VF global variables (such as $API) but without success.
I find the list of these variables but not the members of each.
Can anyone tell me if such documentation exists, or if there is a way to iterate through the global variables members to discover it.

Thanks

Hello,

Here's the scenario : one active community, one account, two contacts. The 2 contacts have the same email address. You want to create a community user for contact One, it associates with contact Two.

Code in CommunitiesSelRegController, called by a commandButton in apex page :

public void test()
    {
        Account a = new Account(Name='Account test', OwnerId='005A0000001fgpe' ); //Owner = me, must have a role
        insert a;
       
        List<Contact> lc = new list<Contact>{
                new Contact(LastName='One', email='same@mail.com', AccountId=a.Id),
                new Contact(LastName='Two', email='same@mail.com', AccountId=a.Id),
                new Contact(LastName='Three', email='different@mail.com', AccountId=a.Id)
                    };
        insert lc;
       
        User u = new User();
        u.userName = lc[1].email;
        u.email = lc[1].email;
        u.FirstName = 'test';   
        u.LastName = lc[1].LastName;
        u.alias = 'watvr';
        u.CommunityNickName=u.alias;
        u.ProfileId = '00eA0000000yex2'; //Customer community user profile
        u.ContactId = lc[1].Id;
         u.CompanyName = a.Name;
        system.debug(u);     // will output User:{ ...ContactId = Two.Id ...}
        String userId = Site.createPortalUser(u, a.Id, null, true);
        system.debug(u);// will output User:{ ...ContactId = One.Id ...}
        }

Don't know where to report this bug...

Hi,

I have a custom field where is stored a 15 digits Id.
I need to build a String csv with the 18 digits version of this Id.
In my Execute anonymous window, I tried a simple

system.debug(Id.valueOf('101c00000001GWe'));

 


and got

USER_DEBUG|[2]|DEBUG|101c00000001GWeAAM

 


Wonderful, that's what I need !  But when I try to write in my class

csv += Id.valueOf(var);

 


I get an ugly

Save error: variable does not exist: Id

 



I finally did what I need by creating a variable with

Id myId = String.valueOf(var); 
csv += myId;

 


But I don't understand why the documented static method Id.valueOf works in anonymous code and not in a class ?

 

Hi,

I have made a worflow rule to send an email to a user when he is late in one step of a program.

The Rule Criteria is
(MyStepObject: Status not equal to Complete) and (ProgramObject: Status not equal to Timed out) and (MyStepObject: FieldToUpdate not equal to null) and (ProgramObject: EndDate greater or equal TODAY)

When the record meets the criteria (typically when it's created), it creates Time-Dependent Workflow Action 21 Days After MyStepObject: EndDate who updates a field, so that a trigger is run and the email is sent to the user. (it creates in fact after 1 , 7 , 14 and 21 days).

Let's consider that the rule is run when the Step record is created, on october 1st, with Step.EndDate = oct 11 and Program.EndDate=oct 31
A field update is scheduled 21 days after oct 11, which is nov 01
I assumed that since there's in the criteria "ProgramObject: EndDate greater or equal TODAY" this action would not have been done because the criteria would have been tested again before it ran, and TODAY(nov01) < Program.EndDate(oct31)

However, the field was updated on nov 01 at 23:00 (and the mail sent).

Can anyone explain me why ?

Thanks for your help

Hello,
I created a custom field of satisfaction with type number.
I made a reques to see what returned me:
select Name,Satisfaction__c from Contact

And I is not got what I wanted:

The desired:
Name, Satisfaction__c
Marcia Morgado, 10
Rosana Moreira, 8
Vanessa Pedrozo, 7

The obtained:
Name, Satisfaction__c
Marcia Morgado, 0032000001E3fVyAAJ
Rosana Moreira, 0032000001D8WWsAAN
Vanessa Pedrozo, 0032000001D8Y4nAAF

CODE:

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

    string queryResultString = '';
    list<sObject> queryResult = (List<sObject>)database.query(inputText);
    for(sObject a: queryResult)
    {
        queryResultString = queryResultString + string.valueof(a);
    }
    list<string> queryLines = queryResultString.split('}');
    for(string s:queryLines){
        list<string> queryCol = s.split(',');
        for(string st:queryCol){
            contenuCSV = contenuCSV + st.substringAfter('=') + ',';
        }
        contenuCSV = contenuCSV.substringBeforeLast(',').substringBeforeLast(',') + '\n';
    }

How do I solve this problem with numeric fields?
Thank you,
Hi all,

I want to update the contact's mail address when the user changes its mail address in Communities.
I have written a trigger but it's not triggered when only the email is changed, probably because the change requires a confirmation (by mail) andis then made via the setup/emailverif page who, I guess, must call special methods, or maybe run with a guest user without any right ?

I have tried to trigger a workflow as well, but same : if I modify the email address from the setup/user interface in salesforce, the workflow (and trigger) is run, but if I modify via Communities -> /setup/emailverif, nothing happens.

Any idea how to fix it, or even to debug it (no debug is available for the emailverif call, maybe because it's run with a guest user I can't add to the usres watched)

Thanks for any answer
Hello,

Here's the scenario : one active community, one account, two contacts. The 2 contacts have the same email address. You want to create a community user for contact One, it associates with contact Two.

Code in CommunitiesSelRegController, called by a commandButton in apex page :

public void test()
    {
        Account a = new Account(Name='Account test', OwnerId='005A0000001fgpe' ); //Owner = me, must have a role
        insert a;
       
        List<Contact> lc = new list<Contact>{
                new Contact(LastName='One', email='same@mail.com', AccountId=a.Id),
                new Contact(LastName='Two', email='same@mail.com', AccountId=a.Id),
                new Contact(LastName='Three', email='different@mail.com', AccountId=a.Id)
                    };
        insert lc;
       
        User u = new User();
        u.userName = lc[1].email;
        u.email = lc[1].email;
        u.FirstName = 'test';   
        u.LastName = lc[1].LastName;
        u.alias = 'watvr';
        u.CommunityNickName=u.alias;
        u.ProfileId = '00eA0000000yex2'; //Customer community user profile
        u.ContactId = lc[1].Id;
         u.CompanyName = a.Name;
        system.debug(u);     // will output User:{ ...ContactId = Two.Id ...}
        String userId = Site.createPortalUser(u, a.Id, null, true);
        system.debug(u);// will output User:{ ...ContactId = One.Id ...}
        }

Don't know where to report this bug...

Hi,

I have a custom field where is stored a 15 digits Id.
I need to build a String csv with the 18 digits version of this Id.
In my Execute anonymous window, I tried a simple

system.debug(Id.valueOf('101c00000001GWe'));

 


and got

USER_DEBUG|[2]|DEBUG|101c00000001GWeAAM

 


Wonderful, that's what I need !  But when I try to write in my class

csv += Id.valueOf(var);

 


I get an ugly

Save error: variable does not exist: Id

 



I finally did what I need by creating a variable with

Id myId = String.valueOf(var); 
csv += myId;

 


But I don't understand why the documented static method Id.valueOf works in anonymous code and not in a class ?

 

Hello,

I have tried to find a reference for the VF global variables (such as $API) but without success.
I find the list of these variables but not the members of each.
Can anyone tell me if such documentation exists, or if there is a way to iterate through the global variables members to discover it.

Thanks