• Jose María Nicolás Arfelis
  • NEWBIE
  • 50 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 22
    Questions
  • 37
    Replies
Hi all,

I am trying to cover some lines in my controller apex class, but since hours dealing with the error message:
 
Expecting colon, found 'TestPostgrado1'.
The method I am trying to cover through my controller test class is this (method in my controller):
 
public list<Product2> getProgramsFromListId(String listId){
    list<Product2> listProgramas = new list<Product2>();
    String query = 'Select Id, Name from Product2 where Id In ' + listId ; 
    listProgramas = Database.query(query);
    return listProgramas;
}
In order to cover that part I have written these lines in my code on the controller test class:
 
Product2 postgrado1 =  new Product2(Name = 'TestPostgrad1');
insert postgrado1;

Product2 postgrado2 =  new Product2(Name = 'TestPostgrad2');
insert postgrado2;

List<Product2> postgrados = new List<Product2> ();
postgrados.add(postgrado1);
postgrados.add(postgrado2);
        
        //List<Product2> listProgramas = new list<Product2>();
        //listProgramas.add(postgrado.Name);
  
controller.getProgramsFromListName(postgrado1.Name);
ok, I know postgrado1.Name is not correct, I was trying with several variants, but nothing happens, the errors is still being displayed.
I tend to think that it has to do with the "IN" in the SELECT statement in the controller method,

Does anybody know, what I am doing wrong or what is missing in the lines in my test class?. The errors are pointing to the line
 
controller.getProgramsFromListName(postgrado1.Name);
in my controller test class.

and to the line
 
listProgramas = Database.query(query);
I would appreciate any help.





 
Hi all,

here I am again with the same topic, this time for asking if there is a possibility to fill the field Account automatically at case creation when the email which comes from the Sender coincides with an existing email for that Account?.
For example, supposing Manuel Perez is registered as Account with email address in Salesforce. Manuel Perez sends an email to the Customer Support advocate. Salesforce should work this looking at every Account if there is an account with the email address of the sender, if yes, it should fill the field Account in the case record which is being created.

Is this possible some way?
Hi all,

I hope someone can help me here as my knowledge in APEX is rudimentary but willing to learn very much.
I was wondering how would the test class to this APEX code of a custom Case controller look like:
 
public class case_controller {

    public case_controller(ApexPages.StandardController controller) {

    }


public String case_FirstName{get;set;}
public String case_LastName{get;set;}
public String case_Email{get;set;}

public String casetype_Esp{get;set;}
public String casetype_Cat{get;set;}
public String casetype_En{get;set;}

public String userLanguage{get;set;}
public Boolean showCaptchaField {get;set;}

// Variables para control de errores
public Boolean show_error{get;set;}
public Boolean error_dni{get;set;}
public Boolean error_no_existe{get;set;}
public Boolean error_dni_case{get;set;}


public String phone_prefix{get;set;}
public Account student{get;set;}

public Case incident{get;set;}

public String array_values{get;set;} 

public String areaSelected{get;set;}
public String areaSelectedEsp{get;set;}
public String areaSelectedEn{get;set;}
public String areaSelectedCat{get;set;}

Public Product2 postgraduatecourseCaso{get;set;}
public String postgraduatecourseSelected{get;set;}
public String postgraduatecourseSelectedText{get;set;}

public List<SelectOption> casetypeOptionsEsp{get;set;} 
public List<SelectOption> casetypeOptionsEn{get;set;} 
public List<SelectOption> casetypeOptionsCat{get;set;} 

public List<SelectOption> motivocasoOptionsEsp{get;set;} 
public List<SelectOption> motivocasoOptionsEn{get;set;} 
public List<SelectOption> motivocasoOptionsCat{get;set;} 

public String IdentificationType_Esp{get;set;} 
public String IdentificationType_En{get;set;} 
public String IdentificationType_Cat{get;set;} 

public List<SelectOption> identificationOptionsEsp{get;set;} 
public List<SelectOption> identificationOptionsEn{get;set;} 
public List<SelectOption> identificationOptionsCat{get;set;} 

public List<SelectOption> areaOptionsEsp{get;set;} 
public List<SelectOption> areaOptionsEn{get;set;} 
public List<SelectOption> areaOptionsCat{get;set;} 


public List<SelectOption> postgraduatecourseOptions{
    get{
        String areaSelected = 'none';
        if(userLanguage == 'Es') areaSelected = areaSelectedEsp;
            else if(userLanguage == 'En') areaSelected = areaSelectedEn;
            else if(userLanguage == 'Cat') areaSelected = areaSelectedCat;

        postgraduatecourseOptions = FormUtils.getpostgraduatecourseOpt(areaSelected, userLanguage); 
        return postgraduatecourseOptions;
        
    }set;
}



private void resetErrors(){
    show_error = false;
    error_dni = false;
    error_no_existe = false;
    error_dni_case = false;
}

public case_controller(){
    incident = new Case();
    resetErrors();
    getListOptions();
    
// El captcha es mostrado sólo cuando la página está en la Web, no si la página se usa para registrar casos en la misma aplicación
  showCaptchaField = !UserUtils.isCurrentUserProfileSecretariaTecnica();
}

// Registrar un caso
public pageReference case_submit(){
   Savepoint sp = Database.setSavepoint();
    String language;
    try{    

        if (userLanguage =='En'){
            language = 'English';
            incident.preferred_language__c = 'English';
            incident.Identification_number_type__c = IdentificationType_En;
            //incident.DNI__c = IdentificationNumber_En;
            incident.Type = casetype_En;
            //incident.Reason = motivocaso_En;
        }
        else if (userLanguage =='Cat'){
            language = 'Catalan';
            incident.preferred_language__c = 'Catalan';
            incident.Identification_number_type__c = IdentificationType_Cat;
            //incident.DNI__c = IdentificationNumber_Cat;
            incident.Type = casetype_Cat;
            //incident.Reason = motivocaso_Cat;
        }
        else{
            language = 'Spanish';
            incident.preferred_language__c = 'Spanish';
            incident.Identification_number_type__c = IdentificationType_Esp;
            //incident.DNI__c = IdentificationNumber_Esp;
            incident.Type = casetype_Esp;
            //incident.Reason = motivocaso_Esp;
        } 

        System.debug('*************** case forms ///// incident '+ incident);
        

        //Preparing the data to create a case

        insert(incident);
    }catch(Exception e){
        system.debug('Exception :' + e);
    }  

    pageReference pageRef = new PageReference('/apex/case_answer_form');
    pageRef.getParameters().put('type','case_form');
    pageRef.getParameters().put('id',student.id);
    pageRef.getParameters().put('lng', userLanguage);
    return pageRef;
}
/**TODO: sacarlo a clase Utils
private Id getAccountIdFromDNI(String dni){
    Account acc = new Account();
    list<Account> accountList = [Select id, FirstName, LastName, DNI__c From Account Where DNI__c = : dni];
    if (accountList != null && accountList.size()>0){
        acc = accountList[0];
    }
    return acc.Id;

}*/

This code is about inserting a case with the values given in the VF form for the fields Postgraduate Course, FirstName, LastName, Email, Type of case, Reason.
I would appreciate any orientation
Hi all,

I have the requirement to get a field autopopulated according to the value of another field.
For example, I have the parent object Postgraduate Course. This has the related list Questions (Preguntas):

The Question object has a lookup to the Postgraduate Course.
To distinguish among postgraduate courses with the same name, we use one field: the Edition of the Postgraduate Course.

The Question edit mode looks like this:

User-added image

For example, if the Postgraduate Course is SEGURIDAD CLINICA and the Edition of that Postgraduate Course is 2017-2018, when you click on the button New on the related object Questions, the field Edtion on this object should be autopopulated with the value in the field Edition of the Postgraduate Course, being in Edit Mode, so our client can recognize for which Postgraduate Course he will add a question.

Is something like that possible in Salesforce?.
Hi all,

I hope that somebody answers my question as I am making efforts to describe what my problem is. I am trying to solve this without success.
I would like to autopopulate two lookup fields when I press the button New on a related list.

Matriculaci_n__c is the object where the related list Títulos is to find. The object is T_tulo__c.
I would like to add a button New on the related list Titulos, in order to get to the detail page where I can find two lookups autopopulated with the Postgraduate Course (Programa_acad_mico_1__c) and the Name of the Applicant (Cuenta_de_Alumno__c) mentioned in the Matriculaci_n__c object.

For this I built the following Apex Code:
 
public with sharing class SobreescribeTituloNuevo {
    
 public SobreescribeTituloNuevo(ApexPages.StandardController controller) {
    }
    public Pagereference onLoad(){
        PageReference newPage = new PageReference('/a10/e?');
        String TituloId;
        for(String keyValue : ApexPages.currentPage().getParameters().keySet()){
            if(!keyValue.contains('override') ){
                newPage.getParameters().put(keyValue, ApexPages.currentPage().getParameters().get(keyValue));
                if(keyValue.contains('retURL')) {
                  TituloId = ApexPages.currentPage().getParameters().get('retURL');
                }
            }
        }
        system.debug(TituloId);
        TituloId =  TituloId.removeStart('/');
        if(TituloId.length() >= 15) {
        Matriculaci_n__c objMatriculacion = [Select Id, Programa_acad_mico_1__c, Programa_acad_mico_1__r.Name, Cuenta_de_Alumno__c, Cuenta_de_Alumno__r.Name from Matriculaci_n__c where Id =: TituloId];
            newPage.getParameters().put('00N3E000000QaTd_lkid', objMatriculacion.Programa_acad_mico_1__c);
            newPage.getParameters().put('00N3E000000QaTd', objMatriculacion.Programa_acad_mico_1__r.Name);
			newPage.getParameters().put('00N3E000000XmQ3_lkid', objMatriculacion.Cuenta_de_Alumno__c);
			newPage.getParameters().put('00N3E000000XmQ3', objMatriculacion.Cuenta_de_Alumno__r.Name);
            newPage.getParameters().put('nooverride','1');
        }
        else {
            newPage.getParameters().put('nooverride','0');
        }
        return newPage.setRedirect(true);
    }
}
My Visualforce page looks like this:
 
<apex:page standardController="T_tulo__c" extensions="SobreescribeTituloNuevo" action="{!onLoad}">
</apex:page>
When I try to create a button for the related list Títulos, the Content field doesn't display anything, does anybody know why?. I already tried with many of the supposed solutions given in the internet, but none works for me, and I don't know where else do I have to change something or where is the mistake here.

User-added image
The IDs are here on this page fictitious.

As you see the Content field is not shown, can please somebody help me? :(.

 
Hi all,

there is a strange behavior regarding sending automatic emails via Salesforce and using templates based on Visualforce and HTML.
When I send an email with a link, this link appears correctly when the email goes to Gmail, but not when going to Hotmail or my client's email address.
When it goes to Hotmail it appears like:

User-added image
When it goes to my client's email address, the link is displayed this way:

User-added image

On Gmail:

User-added image
The code on the email template invoking that link is:
 
<tr>
     
        <td style="text-align:justify;padding: 20px 0 5px 0;padding: 20px 0 30px 0;color: #153643; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;">
          <c:email_solicitud_contacto intencion="{!relatedTo}" language_sc="Es"/>     
        </td>
     
     </tr>
The code in the component email_solicitud_contacto is:
 
<apex:component controller="email_solicitud_contacto_controller" id="emailProgramasComponent" access="global">

    <apex:attribute name="intencion" description="La intención de estudio" type="Intencion_de_estudios__c" />
    <apex:attribute name="language_sc" description="El idioma de la solicitud" type="String" assignto="{!language}" />
    <ul>
        <apex:outputpanel rendered="{!language=='Es'}">
            <li><a href="{!intencion.Producto__r.Enlace_Web__c}">{!intencion.Producto__r.Name} ( {!intencion.Producto__r.Edicion_de_Postgrado__c} )</a></li>
        </apex:outputpanel>
        <apex:outputpanel rendered="{!language=='En'}">
            <li><a href="{!intencion.Producto__r.Enlace_Web__c}">{!intencion.Producto__r.Nombre_de_curso_en_ingles__c} ( {!intencion.Producto__r.Edicion_de_Postgrado__c} )</a></li>
        </apex:outputpanel>
        <apex:outputpanel rendered="{!language=='Cat'}">
            <li><a href="{!intencion.Producto__r.Enlace_Web__c}">{!intencion.Producto__r.Nombre_de_curso_en_catalan__c} ( {!intencion.Producto__r.Edicion_de_Postgrado__c} )</a></li>
        </apex:outputpanel>
    </ul>

</apex:component>
Is there something wrong? how can I apply responsiveness here so the link appears the same for all Email Accounts?.
Please people, I need your help, I am realy doing efforts writing this thread, attaching screenshots, codes, so I would appreciate somebody gives me some light here.





 
Hi all,

we found out some effects of using SItes and addind Visualforce pages to it.
Fonts, styles get distort, why this?.
Hi all,

we all know Products is a standard object. As I am not using this object for opportunities (not using Opportunities or List Prices either) I would like to remove/disable the DEactivate / Activate Link on every Product record. Is that possible?.User-added image
Hi all,

our client would like an automatic data load of .CSV files from an FTP site into Salesforce.
They are using LINUX.

Doing some research I found out that Apache ANT would be a good option for an automatic data load. We were suggesting first to use Jitterbit Cloud Data Loader, but our client (especifically the IT Team not specialized in Salesforce) doesn't want to invest time in updating UPSERT settings in Jitterbit. Jitterbit works in LINUX as well but the version for LINUX is not a free version.

First, as we don't have any shell scripting knowledge, just basic, have somebody here already used Apache ANT? Is Apache ANT free? how a script with command lines in it for our client to use it would look like?. How would this automation would look like?.

How can we test it? can we test it in a virtual machine? which one would you recommend it for LINUX?.

I would appreciate any help, tips.

 
Hi all,

I am looking for possibilities to catch values in a specific Master-Detail field within a junction object.
For example, I have the object Event. There is another object Account --> Record Type "Professors". Event and Professor have a many to many relationship.
For the many to many relationship I created a junction object Relationship Professor - Event. This junction object hast two Master-Detail fields. One pointing to Event and one pointing to a Professor.

Now our client would like to have the values on the Professor Master-Detail fields as comma separated values in a field on the Event object, so they can have a tabular view when entering to the Events tab seeing the Professors participating on that event. For this I created the field "Professor (s)" on the object Event.

For example, if we have:

EVENT         PROFESSOR
Event X        Michael Fox
Event Y        Tanya Mitchells

The field Professors should show: Michael Fox, Tanya Mitchells.

After looking for possible solutions how to implement this, I found this link:

http://blog.jeffdouglas.com/2012/04/10/convert-a-related-list-to-a-comma-separated-list/

when I implemented it, it didn't work totally.
When you delete a professor in the list of professors (Account --> Record Type "Professor"). The related record in the junction object gets deleted. But the field Professor(s) on the object Event doesn't update automatically with the trigger mentioned in the link above. You have first to go to one of the records in the junction object Relationship Professor - Event --> press button Modify on that record and then save. Only after doing this, the field "Professor(s)" on Event gets updated.

Have someone dealt with such a requirement?. Is there something missing in the proposed code in the link mentioned above?.

 
Hi all,

I would like to create a Trigger Handler invoking an Account record type, but after some research and test I couldn't find the way to invoke a specific record type and fields of that record type in APEX. The name of the Account record type I am talking about is "Profesores". Here is my code:
 
public with sharing class ProfesorEventoTriggerHandler {

  @future 
  public static void ProcesaProfesoresAsync(Set<ID> eventoIds){

    // recoge el map del evento id y de los profesores sepprevados por punto y coma a construir
    Map<Id, String> eventoProfesorMap = new Map<Id, String>();
    //RecordType RecType = [Select Id From RecordType Where SobjectType = 'Account' and DeveloperName = 'Profesores'];

    // consigue TODOS los profesores para todos los eventos afectados de tal modo que podamos construir
    List<Relacion_Profesor_Evento__c> eventoProfesores = [select id, Evento__c, RecType.Id
      Account.Name from Relacion_Profesor_Evento__c 
      where Evento__c IN :eventoIds order by Account.Name];

    for (Relacion_Profesor_Evento__c prev : eventoProfesores) {
      if (!eventoProfesorMap.containsKey(prev.Evento__c)) {
        // si el key del evento no existe, agregarlo con nombre del profesor
        eventoProfesorMap.put(prev.Evento__c,prev.Account.Name);
      } else {
        // si el key del evento ya existe, agregar ", 
        // if the key (account) already exist, add "; nombre del profesor"
        eventoProfesorMap.put(prev.Evento__c,eventoProfesorMap.get(prev.Evento__c) + 
          ', ' + prev.Account.Name);
      }
    }

    // consigue los eventos que fueron afectados
    List<Evento__c> eventos = [select id from Evento__c where Id IN :eventoIds];

    // agrega la lista de profesores separados por punto y coma
    for (Evento__c ev : eventos)
      ev.Account = eventoProfesorMap.get(ev.id);

    // actualiza los eventos
    update eventos;

  }  

}
Account.Name should be for example something like this "get the value in field Name of the Record type "Profesores" of the object Account".

Can please somebody help me as I am stuck here since hours?.

Regards
 
Hi all,

is it possible to merge two related lists pointing to the same object using Visualforce?.

On one event can participate one or more professors, but one professor can participate on one or more events.
I know, this is possible using a junction object, but if I create two lookups on the object Event, say, Professor 1 and Professor 2 pointing to the same object Professor, this creates two related lists Event and Event (Professor 2) on the detail page of every professor.

Is there any possibility to merge both related lists so this list shows all records in only one related list?. The benefit would be for the user to see with only one click all details of an event on the related list than using a junction object.

I would appreciate you help.
Hi all,

as I am a newbie in the programming world in Salesforce, I would like to know, which kind of codes in Salesforce need a "Test" part?.
Til now, I know Triggers need it, which other types of Codes need a "Test" part.

I would appreciate your answers.

Best regards.

 
Hi all,

we have an email template built with Visualforce with "relatedToType="ObjectA__c":
 
<messaging:emailTemplate subject="Answer to your Request for Information" recipientType="Contact" relatedToType="ObjectA__c">
ObjectA was created to store all Resquests for Informations coming to Salesforce from the university web.

On the other hand, ObjectB was created to store all links the university, our client, has.
For ObjectB these fields were created: Name of Link, URL of Link.

ObjectA and ObjectB have no relationship, means, no Master-Detail and no Lookup.

However, I would like to refer to the field URL of the Link of ObjectB in the email template this way:
 
<messaging:emailTemplate subject="Answer to your Request for Information" recipientType="Contact" relatedToType="ObjectA__c">
...
<apex:outputLink value="{!IF(ObjectB__r.Name_of_Link__c = 'URL Admission Form', '{!ObjectB__r.URL_of_Link__c}', '')}" id="Admission">Admission Form</apex:outputLink>

...
The objective is for future manual changes in the value of the field URL of Link, to do these changes directly in the tab for ObjectB and not in the email template.

I tried using the code above, but it doesn't work.
Even refering to a formula field doesn't work.

I would appreciate your tips as I am struggling hours and hours trying to solve this :(.
Hi all,

down vote favoritewe have the object Preinscripción containing records about which Postgraduate course someone applied for and paid. It contains the Name of the Applicant, the Postgraduate Course, the Identification Number, Status of the Preinscripción and a checkbox indicating whether a record with the same values Name of Applicant, Postgraduate Course and Identification Number exists or not in another object, the object Admission.
For example, let's say I have a record with data Name Pepe Flores, Postgraduate Course Cardiovascular Medicine, ID Number 1234567 in the object Preinscripción, if these values are also contained in the same fields in the object Admission, the checkbox should automatically be checked or populated.
Is it possible to make that work? is coding needed?.
The standard Salesforce activity object has this field set for recurring events:
User-added image
We would like to recreate / resemble this approach for a custom object which has a Start Date and an End Date amd where the user needs to create recurring events.

If someone knows how to do it (I am not a programmer) per APEX, if this is te only possibility, I would appreciate any helpful answer here.
I would like to add more than one dashboard to the home page in Salesforce (at least would like to have 3 dashboards on the home page).

After reading many similar threads, I tried the suggestions given there.
One with a code:
 
<iframe src="/00000000000?isdtp=lt" frameborder="0" height="900" width="1280"></iframe>
It seems to be this doesn't work anymore after many releases in Salesforce. Threads that I found had the year 2013 or less. So I guess from 2013 this is not working anymore.
I also replaced the parte iframe by "location.href=", but it didn't work. I use Visualforce.

Though, I would appreciate if someone knows how to code that, so this can work. I have the Enterprise edition.


 
Hi everybody,

in our implementation we decided to have all information about the process of student recruiting in separate related lists.

So, for example, under the object Person Accout (the applicant) we have the following related lists:

- Admissions
- Enrollments

Admissions are all the records being created while the Admission process is taking place and also contain student application information.
Enrollments would have all records related to the Admissions but where you can see if the student has paid or not the course or academic programm he has now to pay.

Is it possible to make appear only all admission records, whose admission stage is in "Admission approved" in the Enrollments related list?.

Only admissions which were approved would appear in the related list for Enrollments. Is that possible?
Hi everybody,

I have the following scenario:

an applicant can have one or more applications, for this I am using a Person Account object and a custom object called Admisión. The object Admisión has a lookup field called Name of the Account, pointing to the Person Account or applicant, so the applicant has a related list called Admisiones.

The Admisión object has the field Stage with values Review pending, In review, Admission accepted, Admission denied. I wanted to have a Status field in the Person Account object with values "Initial contact", "Admission Inquiry", "Admission denied" and "Admission accepted", so their values change according to the stage value in the object Admisión.

The problem is: an applicant can not have a general status for all applications submitted by the applicant, as an application can have one status and the another application another status.

We would like further to build reports based on the status of the applicant, would be a good approach to add the applicant status field in the object Admisión? or wouldn't you consider even to use this field?.

I guess this can only be implemented with code.
Thinking about this: for example, if the applicant has three applications, one in stage "In review", another in stage "Denied" and the another one in stage "Accepted", the application with the "highest" level of stage should "win" and be the criterium in order to change the status of the applicant from "Admission inquiry" to "Admission accepted".

I think, this can not be done with Process Builder but programm code is needed. Does anybody know how to build a programm which makes this idea possible to implement?.
Hi everybody,

this thread could help other Salesforce Community followers if they are facing the same situation.

Our client requires a sort of dynamic questions for Student Applications via Web forms.
That means, for every academic programm there will be questions the applicant will have to answer.
For example, if the applicant chooses the academic programm "Medicine" on the web form, let's assume the following questions would appear:

1. Have you ever performed complex surgical operations? (Answer Type: Yes or No)
2. If yes, which was your most complex surgical operation? (Answer Type: Text)
3. When did you begin to perform operations? (Answer Type: Date)

That means, according to the selected academic programm, the corresponding questions will appear. And according to the type of question (if picklist, text, Yes/No, numeric, date, multiple choice) the corresponding type of Answer will appear.


I built a custom object called Question with fields Question ID, ID of the academic programm, Type (if picklist, if checkbox, if text, if date, if numeric).
I also built a custom object called Answers with fields Question ID, Application ID, Type (text, numeric, Date, boolean), Answer Text (type text), Answer Numeric (type numeric) , Answer Boolean (type boolean), Answer date (type date).

The idea in Salesforce is that when the question is numeric, the Answer field which should appear should be the Answer numeric, if the question is date type, Answer date should appear, if the question is text or checkbox type, Answer text should appear.

Question ID in the custom object Answer is a lookup to the object Question.

Is there any form to manage this through validation or Visualforce?.
Hi all,

I am trying to cover some lines in my controller apex class, but since hours dealing with the error message:
 
Expecting colon, found 'TestPostgrado1'.
The method I am trying to cover through my controller test class is this (method in my controller):
 
public list<Product2> getProgramsFromListId(String listId){
    list<Product2> listProgramas = new list<Product2>();
    String query = 'Select Id, Name from Product2 where Id In ' + listId ; 
    listProgramas = Database.query(query);
    return listProgramas;
}
In order to cover that part I have written these lines in my code on the controller test class:
 
Product2 postgrado1 =  new Product2(Name = 'TestPostgrad1');
insert postgrado1;

Product2 postgrado2 =  new Product2(Name = 'TestPostgrad2');
insert postgrado2;

List<Product2> postgrados = new List<Product2> ();
postgrados.add(postgrado1);
postgrados.add(postgrado2);
        
        //List<Product2> listProgramas = new list<Product2>();
        //listProgramas.add(postgrado.Name);
  
controller.getProgramsFromListName(postgrado1.Name);
ok, I know postgrado1.Name is not correct, I was trying with several variants, but nothing happens, the errors is still being displayed.
I tend to think that it has to do with the "IN" in the SELECT statement in the controller method,

Does anybody know, what I am doing wrong or what is missing in the lines in my test class?. The errors are pointing to the line
 
controller.getProgramsFromListName(postgrado1.Name);
in my controller test class.

and to the line
 
listProgramas = Database.query(query);
I would appreciate any help.





 
Hi all,

I have the requirement to get a field autopopulated according to the value of another field.
For example, I have the parent object Postgraduate Course. This has the related list Questions (Preguntas):

The Question object has a lookup to the Postgraduate Course.
To distinguish among postgraduate courses with the same name, we use one field: the Edition of the Postgraduate Course.

The Question edit mode looks like this:

User-added image

For example, if the Postgraduate Course is SEGURIDAD CLINICA and the Edition of that Postgraduate Course is 2017-2018, when you click on the button New on the related object Questions, the field Edtion on this object should be autopopulated with the value in the field Edition of the Postgraduate Course, being in Edit Mode, so our client can recognize for which Postgraduate Course he will add a question.

Is something like that possible in Salesforce?.
Hi all,

I hope that somebody answers my question as I am making efforts to describe what my problem is. I am trying to solve this without success.
I would like to autopopulate two lookup fields when I press the button New on a related list.

Matriculaci_n__c is the object where the related list Títulos is to find. The object is T_tulo__c.
I would like to add a button New on the related list Titulos, in order to get to the detail page where I can find two lookups autopopulated with the Postgraduate Course (Programa_acad_mico_1__c) and the Name of the Applicant (Cuenta_de_Alumno__c) mentioned in the Matriculaci_n__c object.

For this I built the following Apex Code:
 
public with sharing class SobreescribeTituloNuevo {
    
 public SobreescribeTituloNuevo(ApexPages.StandardController controller) {
    }
    public Pagereference onLoad(){
        PageReference newPage = new PageReference('/a10/e?');
        String TituloId;
        for(String keyValue : ApexPages.currentPage().getParameters().keySet()){
            if(!keyValue.contains('override') ){
                newPage.getParameters().put(keyValue, ApexPages.currentPage().getParameters().get(keyValue));
                if(keyValue.contains('retURL')) {
                  TituloId = ApexPages.currentPage().getParameters().get('retURL');
                }
            }
        }
        system.debug(TituloId);
        TituloId =  TituloId.removeStart('/');
        if(TituloId.length() >= 15) {
        Matriculaci_n__c objMatriculacion = [Select Id, Programa_acad_mico_1__c, Programa_acad_mico_1__r.Name, Cuenta_de_Alumno__c, Cuenta_de_Alumno__r.Name from Matriculaci_n__c where Id =: TituloId];
            newPage.getParameters().put('00N3E000000QaTd_lkid', objMatriculacion.Programa_acad_mico_1__c);
            newPage.getParameters().put('00N3E000000QaTd', objMatriculacion.Programa_acad_mico_1__r.Name);
			newPage.getParameters().put('00N3E000000XmQ3_lkid', objMatriculacion.Cuenta_de_Alumno__c);
			newPage.getParameters().put('00N3E000000XmQ3', objMatriculacion.Cuenta_de_Alumno__r.Name);
            newPage.getParameters().put('nooverride','1');
        }
        else {
            newPage.getParameters().put('nooverride','0');
        }
        return newPage.setRedirect(true);
    }
}
My Visualforce page looks like this:
 
<apex:page standardController="T_tulo__c" extensions="SobreescribeTituloNuevo" action="{!onLoad}">
</apex:page>
When I try to create a button for the related list Títulos, the Content field doesn't display anything, does anybody know why?. I already tried with many of the supposed solutions given in the internet, but none works for me, and I don't know where else do I have to change something or where is the mistake here.

User-added image
The IDs are here on this page fictitious.

As you see the Content field is not shown, can please somebody help me? :(.

 
Hi all,

there is a strange behavior regarding sending automatic emails via Salesforce and using templates based on Visualforce and HTML.
When I send an email with a link, this link appears correctly when the email goes to Gmail, but not when going to Hotmail or my client's email address.
When it goes to Hotmail it appears like:

User-added image
When it goes to my client's email address, the link is displayed this way:

User-added image

On Gmail:

User-added image
The code on the email template invoking that link is:
 
<tr>
     
        <td style="text-align:justify;padding: 20px 0 5px 0;padding: 20px 0 30px 0;color: #153643; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;">
          <c:email_solicitud_contacto intencion="{!relatedTo}" language_sc="Es"/>     
        </td>
     
     </tr>
The code in the component email_solicitud_contacto is:
 
<apex:component controller="email_solicitud_contacto_controller" id="emailProgramasComponent" access="global">

    <apex:attribute name="intencion" description="La intención de estudio" type="Intencion_de_estudios__c" />
    <apex:attribute name="language_sc" description="El idioma de la solicitud" type="String" assignto="{!language}" />
    <ul>
        <apex:outputpanel rendered="{!language=='Es'}">
            <li><a href="{!intencion.Producto__r.Enlace_Web__c}">{!intencion.Producto__r.Name} ( {!intencion.Producto__r.Edicion_de_Postgrado__c} )</a></li>
        </apex:outputpanel>
        <apex:outputpanel rendered="{!language=='En'}">
            <li><a href="{!intencion.Producto__r.Enlace_Web__c}">{!intencion.Producto__r.Nombre_de_curso_en_ingles__c} ( {!intencion.Producto__r.Edicion_de_Postgrado__c} )</a></li>
        </apex:outputpanel>
        <apex:outputpanel rendered="{!language=='Cat'}">
            <li><a href="{!intencion.Producto__r.Enlace_Web__c}">{!intencion.Producto__r.Nombre_de_curso_en_catalan__c} ( {!intencion.Producto__r.Edicion_de_Postgrado__c} )</a></li>
        </apex:outputpanel>
    </ul>

</apex:component>
Is there something wrong? how can I apply responsiveness here so the link appears the same for all Email Accounts?.
Please people, I need your help, I am realy doing efforts writing this thread, attaching screenshots, codes, so I would appreciate somebody gives me some light here.





 
Hi all,

I would like to create a Trigger Handler invoking an Account record type, but after some research and test I couldn't find the way to invoke a specific record type and fields of that record type in APEX. The name of the Account record type I am talking about is "Profesores". Here is my code:
 
public with sharing class ProfesorEventoTriggerHandler {

  @future 
  public static void ProcesaProfesoresAsync(Set<ID> eventoIds){

    // recoge el map del evento id y de los profesores sepprevados por punto y coma a construir
    Map<Id, String> eventoProfesorMap = new Map<Id, String>();
    //RecordType RecType = [Select Id From RecordType Where SobjectType = 'Account' and DeveloperName = 'Profesores'];

    // consigue TODOS los profesores para todos los eventos afectados de tal modo que podamos construir
    List<Relacion_Profesor_Evento__c> eventoProfesores = [select id, Evento__c, RecType.Id
      Account.Name from Relacion_Profesor_Evento__c 
      where Evento__c IN :eventoIds order by Account.Name];

    for (Relacion_Profesor_Evento__c prev : eventoProfesores) {
      if (!eventoProfesorMap.containsKey(prev.Evento__c)) {
        // si el key del evento no existe, agregarlo con nombre del profesor
        eventoProfesorMap.put(prev.Evento__c,prev.Account.Name);
      } else {
        // si el key del evento ya existe, agregar ", 
        // if the key (account) already exist, add "; nombre del profesor"
        eventoProfesorMap.put(prev.Evento__c,eventoProfesorMap.get(prev.Evento__c) + 
          ', ' + prev.Account.Name);
      }
    }

    // consigue los eventos que fueron afectados
    List<Evento__c> eventos = [select id from Evento__c where Id IN :eventoIds];

    // agrega la lista de profesores separados por punto y coma
    for (Evento__c ev : eventos)
      ev.Account = eventoProfesorMap.get(ev.id);

    // actualiza los eventos
    update eventos;

  }  

}
Account.Name should be for example something like this "get the value in field Name of the Record type "Profesores" of the object Account".

Can please somebody help me as I am stuck here since hours?.

Regards
 
Hi all,

as I am a newbie in the programming world in Salesforce, I would like to know, which kind of codes in Salesforce need a "Test" part?.
Til now, I know Triggers need it, which other types of Codes need a "Test" part.

I would appreciate your answers.

Best regards.

 
Hi all,

we have an email template built with Visualforce with "relatedToType="ObjectA__c":
 
<messaging:emailTemplate subject="Answer to your Request for Information" recipientType="Contact" relatedToType="ObjectA__c">
ObjectA was created to store all Resquests for Informations coming to Salesforce from the university web.

On the other hand, ObjectB was created to store all links the university, our client, has.
For ObjectB these fields were created: Name of Link, URL of Link.

ObjectA and ObjectB have no relationship, means, no Master-Detail and no Lookup.

However, I would like to refer to the field URL of the Link of ObjectB in the email template this way:
 
<messaging:emailTemplate subject="Answer to your Request for Information" recipientType="Contact" relatedToType="ObjectA__c">
...
<apex:outputLink value="{!IF(ObjectB__r.Name_of_Link__c = 'URL Admission Form', '{!ObjectB__r.URL_of_Link__c}', '')}" id="Admission">Admission Form</apex:outputLink>

...
The objective is for future manual changes in the value of the field URL of Link, to do these changes directly in the tab for ObjectB and not in the email template.

I tried using the code above, but it doesn't work.
Even refering to a formula field doesn't work.

I would appreciate your tips as I am struggling hours and hours trying to solve this :(.
Hi all,

down vote favoritewe have the object Preinscripción containing records about which Postgraduate course someone applied for and paid. It contains the Name of the Applicant, the Postgraduate Course, the Identification Number, Status of the Preinscripción and a checkbox indicating whether a record with the same values Name of Applicant, Postgraduate Course and Identification Number exists or not in another object, the object Admission.
For example, let's say I have a record with data Name Pepe Flores, Postgraduate Course Cardiovascular Medicine, ID Number 1234567 in the object Preinscripción, if these values are also contained in the same fields in the object Admission, the checkbox should automatically be checked or populated.
Is it possible to make that work? is coding needed?.
Email service address is too long for something I ma trying to implement.  I need it below 64 characters.  Is there a way to shorten the email service address besides before the @