• Nicolás Kacowicz
  • NEWBIE
  • 20 Points
  • Member since 2017


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 19
    Replies
Hello, I have tried everything, from deleting and starting my code over to looking for a working code on the Internet.

Today a co-worker came to my office to talk about superbadges and we discuss this one and I remembered that I am stuck on the latest step and can't move forward.

Here is my external object:

User-added image

There's a weird thing, when I go to sync and validate on the External Data Sources, the projectRef field is change to text and I get no data. Today I had opened the developer console and realized that I was getting an error on the logs tab when I submitted to Check if the step #9 was correct:

EXCEPTION_THROWN [4]|System.AssertException: Assertion Failed: Expected: ProjectRef__c, Actual: projectRef__c

I have no idea where this error is coming from, I do not do an Assertion to check this. 
After submitting to check the challenge I get 3 logs, 2 success and the latest one with that error.
Hello, If I put:
 
<script type="text/javascript">
            window.onload = setFocus
            function setFocus() {
                if({!reloadDown}) {
                    document.getElementById('{!$Component.buttons.sabr}').scrollIntoView();
                }
            }
</script>
The image of the help text is disabled, if I hover the mouse over it, it does nothing.

But if I delete  
window.onload = setFocus

It works.

Any idea why?
And will it affect my code if I delete this image?
I'm using this function because I have a radio button that if the answer is yes it will show more radio buttons, and they are down the page so I don't want the page to be reloaded to the top so I set focus to a button that is on the bottom.​
Hello everyone, I have a problem that it is driving me crazy. I have radio buttons on my Visualforce page, some of the radio buttons are hidden when you first open the page, but if let's say the radio button #10 is changed to the option 'Yes', I refresh the page and show 2 more radio buttons.

My problem is that it's always reloading the page to the top and I don't want it.
I have this radio buttons inside pageblock and outputpanel.
I was able to make it work to go to a button but not a radio button.

On Apex I have differents functions to each radio button that displays hidden radio buttons.
I called this function like this:
 
<apex:selectRadio value="{!contact.LivesInAmerica__c}" label="Do you live in America?" id="rb1">
     <apex:selectoptions value="{!types}"></apex:selectoptions>
     <apex:actionSupport event="onchange" action="{!functionFirst}"/>
</apex:selectRadio>
<apex:selectRadio rendered="{!showRB1}" value="{!contact.Street__c}" label="Street">
     <apex:selectoptions value="{!types}"></apex:selectoptions>
</apex:selectRadio>
And this code on Apex Class Controller:
 
public PageReference functionFirst(){
        if(contact.LivesInAmerica__c == 'Yes'){
            showRB1= true;
        }
        else {
            showRB1= false;
        }
        return null;
    }

Thanks!

 
Hello guys, let's say I have the following code:
 
@RestResource(urlMapping='/Account/*')
global with sharing class MyRestResource {
  
  @HttpPost
    global static String doPost(String name,
        String phone, String website) {
        Account account = new Account();
        account.Name = name;
        account.phone = phone;
        account.website = website;
        insert account;
        return account.Id;
    }
}

I'm testing it through https://www.hurl.it/ and there is an authentication section with username and password. My question is how can I check if it is the right combination?

And what would happen if they send me the information through a webservice that's not like that website but just an endpoint to my website? 
Hello, I have a Visualforce page that has lightningStylesheets="true" and when I click 'preview' I see it as a lightning page, but I also have a force.com site that has this Visualforce page and when I open it through the Anonymous Chrome it shows Classic instead of Lightning.

Thanks!
Hello, I've tried everything on this forum but I still can't pass this challenge.
The error is: 
The 'projectRef__c' field is not configured correctly as an Indirect Lookup field.

Here is how I configured the External Object:

User-added image
On some comments it was said to change the name of projectRef to External ID but it didn't work either.

Thanks in advance
Hello, I have created a Visualforce Page that is a form to insert a new record of a Custom Object. I have tried using <apex:pageblocksection> and <apex:pageblocksectionitem> but it doesn't work.

I have a Help Text on this field and if I try to insert a new record on salesforce it shows me the help text, but on visualforce it just shows the image but when I go over with the mouse nothing happens.
There is no data loaded on the page at the beggining, then I refresh it a couple of times to show/hide some fields.

I read on https://developer.salesforce.com/forums/?id=906F000000096rTIAQ something about the onload function but I have no idea about that.

I just want to use the Help Text that I put on the field on Salesforce on my Visualforce page.

PD: I have showHeader="true" and tried setting it to false but nothing happens.

Thanks!
Hello, I've got a Visualforce Page that is just a form with a Save button.
I'm trying to display a message if the record is inserted correctly or not, and if it is inserted correctly I want to reload the page and delete every value stored in the form.
I have this Apex Code:

public PageReference save() {
        try {
            upsert accRecord;
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.CONFIRM,'Record submited successfully'));
        } catch(System.DMLException e) {
            //ApexPages.addMessages(e);
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Please enter Account Name'));
            return null;
        }
        //  After successful Save, navigate to the default view page        
        PageReference tempPage = ApexPages.currentPage(); 
        tempPage.setRedirect(true);
        return tempPage;
        //return null;
    }

Right now it doesn't show the message, but if I delete the PageReference tempPage variable and leave 'return null' it will show the message and but stay in the same page with the values of the inserted record.

Thanks!
Hello, I'm getting the following error:

Challenge Not yet complete... here's what's wrong: 
The 'projectRef__c' field is not configured correctly as an Indirect Lookup field.

I've googled it and tried every solution but I can't fix it.

Here is how I've got configured the External Object:

User-added image

Something weird is that I'm in the last step and I have no data on the Project object. I've done Validate and Sync but nothing.

Thanks!!
Hi, I posted the same question on Apex Code Development but maybe it fits better here.

Hello, I'm getting both of these errors.
I'm trying to upload Accounts through a CSV file from a Visualforce Page. The csv file is 300kb.
I have a for that reads the csv file, and then I use Database.upsert.

I got both the Apex Class and the VF Page from http://www.forcetree.com/2010/08/read-and-insert-records-from-csv-file.html.

I just customized to my needs, mostly the Apex Class. 
This is the Visualforce Page:

<apex:page sidebar="false" controller="FileUploaderAccountTotal" showHeader="false">
    <apex:form >
        <apex:sectionHeader title="Upload data from CSV file"/>
        <apex:pagemessages />
        <apex:pageBlock >
            <!--  Component to allow user to upload file from local machine -->
            <center>
                <apex:inputFile value="{!contentFile}" filename="{!nameFile}" /> <apex:commandButton action="{!ReadFile}" value="Upload File" id="theButton" style="width:70px;"/>
            </center>  
            
            <!-- After the user clicks the 'Upload File' button, this section displays the inserted data -->
            
            <apex:pageblocktable value="{!uploadedAccountsTotal}" var="con" rendered="{!NOT(ISNULL(uploadedAccountsTotal))}">
                <apex:column headerValue="Name">
                    <apex:outputField value="{!con.Name}"/>
                </apex:column>
                <apex:column headerValue="Sponsor">
                    <apex:outputField value="{!con.Sponsor__c}"/>
                </apex:column>
                <apex:column headerValue="Areas">
                    <apex:outputField value="{!con.Areas__c}"/>
                </apex:column>
            </apex:pageblocktable>            
            
        </apex:pageBlock>       
    </apex:form>   
</apex:page>

I even tried to put public transient Blob contentFile{get;set;} with the transient but it didn't matter. I need to be able to upload a file larger than that.

For the CPU time I don't understand what I'm doing wrong, I have this big for with no query inside and then after an upload I have a for of the same size that inserts some Lookup IDs needed to the Object.

Thanks!
Hello, I'm getting both of these errors.
I'm trying to upload Accounts through a CSV file from a Visualforce Page. The csv file is 300kb.
I have a for that reads the csv file, and then I use Database.upsert.

I got both the Apex Class and the VF Page from http://www.forcetree.com/2010/08/read-and-insert-records-from-csv-file.html.

I just customized to my needs, mostly the Apex Class. 
This is the Visualforce Page:

<apex:page sidebar="false" controller="FileUploaderAccountTotal" showHeader="false">
    <apex:form >
        <apex:sectionHeader title="Upload data from CSV file"/>
        <apex:pagemessages />
        <apex:pageBlock >
            <!--  Component to allow user to upload file from local machine -->
            <center>
                <apex:inputFile value="{!contentFile}" filename="{!nameFile}" /> <apex:commandButton action="{!ReadFile}" value="Upload File" id="theButton" style="width:70px;"/>
            </center>  
            
            <!-- After the user clicks the 'Upload File' button, this section displays the inserted data -->
            
            <apex:pageblocktable value="{!uploadedAccountsTotal}" var="con" rendered="{!NOT(ISNULL(uploadedAccountsTotal))}">
                <apex:column headerValue="Name">
                    <apex:outputField value="{!con.Name}"/>
                </apex:column>
                <apex:column headerValue="Sponsor">
                    <apex:outputField value="{!con.Sponsor__c}"/>
                </apex:column>
                <apex:column headerValue="Areas">
                    <apex:outputField value="{!con.Areas__c}"/>
                </apex:column>
            </apex:pageblocktable>            
            
        </apex:pageBlock>       
    </apex:form>   
</apex:page>

I even tried to put public transient Blob contentFile{get;set;} with the transient but it didn't matter. I need to be able to upload a file larger than that.

For the CPU time I don't understand what I'm doing wrong, I have this big for with no query inside and then after an upload I have a for of the same size that inserts some Lookup IDs needed to the Object.

Thanks!
Hello, let's say I have a custom object like Account. I receive a cvs file with the name and other data fields and an external ID.

I want to update if the Account already exists, or create a new Account if it doesn't.

I thought of putting all of the External IDs of the file in a list and then use Set or Map and then do a query to get the Accounts that have these External IDs so I don't do a new Account.

The problem is I don't know where to start :(

Can anyone give me a hand with a simple example?

I don't want to do a query inside the loop because I understand it's a bad practice.

Thanks!
Hello, I'm trying to insert a CSV file. It's just a simple vsp that I choose a local file to upload and show the data in a table.

I'm trying to insert contacts, the problem is if I try to insert more than 1 contact and if I insert the AccountId field. I know it's a lookup field, I googled and I understood that I have to insert the Account Id instead of the Account Name.

Here is the apex class:

public class FileUploaderContacts
{
    public string nameFile{get;set;}
    public Blob contentFile{get;set;}
    String[] filelines = new String[]{};
    List<Contact> conupload; 
    
    /***This function reads the CSV file and inserts records into the Account object. ***/
    public Pagereference ReadFile()
    {
        try{
                //Convert the uploaded file which is in BLOB format into a string
                nameFile =blobToString( contentFile,'ISO-8859-1');
                
                //Now sepatate every row of the excel file
                filelines = nameFile.split('\n');
                
                //Iterate through every line and create a Contact record for each row
                conupload = new List<Contact>();
                for (Integer i=1;i<filelines.size();i++)
                {
                    String[] inputvalues = new String[]{};
                    inputvalues = filelines[i].split(',');
                    
                    Contact c = new Contact();
                    
                    c.FirstName = inputvalues[0];
                    c.LastName = inputvalues[1];                    
                    c.Phone = inputvalues[2];     
                    c.AccountId = inputvalues[3];                   
                    
                    conupload.add(c);
                }
         }
         catch(Exception e){
                 ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured reading the CSV file'+e.getMessage());
                ApexPages.addMessage(errormsg);
         }       
        //Finally, insert the collected records
        try{
            insert conupload;
        }
        catch (Exception e)
        {
            ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured inserting the records'+e.getMessage());
            ApexPages.addMessage(errormsg);
        }    
        return null;
    }
   
   /**** This function sends back to the visualforce page the list of account records that were inserted ****/ 
    public List<Contact> getuploadedContacts()
    {
        if (conupload!= NULL)
            if (conupload.size() > 0)
                return conupload;
            else
                return null;                    
        else
            return null;
    }  
        /**
         This function convers the input CSV file in BLOB format into a string
        @param input    Blob data representing correct string in @inCharset encoding
        @param inCharset    encoding of the Blob data (for example 'ISO 8859-1')
     */
    public static String blobToString(Blob input, String inCharset){
        String hex = EncodingUtil.convertToHex(input);
        System.assertEquals(0, hex.length() & 1);
        final Integer bytesCount = hex.length() >> 1;
        String[] bytes = new String[bytesCount];
        for(Integer i = 0; i < bytesCount; ++i)
            bytes[i] =  hex.mid(i << 1, 2);
        return EncodingUtil.urlDecode('%' + String.join(bytes, '%'), inCharset);
    }         
}

And here is the Visualforce Page:

<apex:page sidebar="false" controller="FileUploaderContacts" showHeader="false">
   <apex:form >
      <apex:sectionHeader title="Upload Contacts from CSV file"/>
      <apex:pagemessages />
      <apex:pageBlock >
             <!--  Component to allow user to upload file from local machine -->
             <center>
              <apex:inputFile value="{!contentFile}" filename="{!nameFile}" />
              <apex:commandButton action="{!ReadFile}" value="Upload File" id="theButton" style="width:70px;"/>
             </center>  
      
      <!-- After the user clicks the 'Upload File' button, this section displays the inserted data -->
      
      <apex:pageblocktable value="{!uploadedContacts}" var="con" rendered="{!NOT(ISNULL(uploadedContacts))}">
          <apex:column headerValue="Contact First Name">
              <apex:outputField value="{!con.FirstName}"/>
          </apex:column>
          <apex:column headerValue="Contact last Name">
              <apex:outputField value="{!con.LastName}"/>
          </apex:column>
          <apex:column headerValue="Phone">
              <apex:outputField value="{!con.Phone}"/>
          </apex:column>
          <apex:column headerValue="Account">
              <apex:outputField value="{!con.AccountId}"/>
          </apex:column>
      </apex:pageblocktable> 
      
      </apex:pageBlock>       
   </apex:form>   
</apex:page>

Here is the CSV file:

FirstName ,LastName ,Phone ,AccountId 
John,Doe,099654789,0011I00000CwooBQAR
Jane,Doe,099520,0011I00000Cw6vlQAB

I got both of them from http://www.forcetree.com/2010/08/read-and-insert-records-from-csv-file.html and just customized it.

Thanks!

PD: just to be clear, if I insert only 1 contact in the CSV file everything works, and if I insert more than 1 contact without the AccountId field it works.
Hello, I'm just starting to use Salesforce.
Let's say I've got a website with a form to insert a Contact. After the contact is inserted on my web, I want to send a JSON to Salesforce so this Contact is inserted on the Contact Object.

I don't quite understand what I need on my website to communicate with Salesforce.

Thanks!!
Estoy intentando utiizar "Data Loader" pero cuando me pide el nombre de usuario y contraseña de Trailhead me aparece este cartel 

User-added image

ya cambié la clave 2 veces. Alguien me puede decir dónde puede estar el error?
Hello, If I put:
 
<script type="text/javascript">
            window.onload = setFocus
            function setFocus() {
                if({!reloadDown}) {
                    document.getElementById('{!$Component.buttons.sabr}').scrollIntoView();
                }
            }
</script>
The image of the help text is disabled, if I hover the mouse over it, it does nothing.

But if I delete  
window.onload = setFocus

It works.

Any idea why?
And will it affect my code if I delete this image?
I'm using this function because I have a radio button that if the answer is yes it will show more radio buttons, and they are down the page so I don't want the page to be reloaded to the top so I set focus to a button that is on the bottom.​
Hello everyone, I have a problem that it is driving me crazy. I have radio buttons on my Visualforce page, some of the radio buttons are hidden when you first open the page, but if let's say the radio button #10 is changed to the option 'Yes', I refresh the page and show 2 more radio buttons.

My problem is that it's always reloading the page to the top and I don't want it.
I have this radio buttons inside pageblock and outputpanel.
I was able to make it work to go to a button but not a radio button.

On Apex I have differents functions to each radio button that displays hidden radio buttons.
I called this function like this:
 
<apex:selectRadio value="{!contact.LivesInAmerica__c}" label="Do you live in America?" id="rb1">
     <apex:selectoptions value="{!types}"></apex:selectoptions>
     <apex:actionSupport event="onchange" action="{!functionFirst}"/>
</apex:selectRadio>
<apex:selectRadio rendered="{!showRB1}" value="{!contact.Street__c}" label="Street">
     <apex:selectoptions value="{!types}"></apex:selectoptions>
</apex:selectRadio>
And this code on Apex Class Controller:
 
public PageReference functionFirst(){
        if(contact.LivesInAmerica__c == 'Yes'){
            showRB1= true;
        }
        else {
            showRB1= false;
        }
        return null;
    }

Thanks!

 
Hello guys, let's say I have the following code:
 
@RestResource(urlMapping='/Account/*')
global with sharing class MyRestResource {
  
  @HttpPost
    global static String doPost(String name,
        String phone, String website) {
        Account account = new Account();
        account.Name = name;
        account.phone = phone;
        account.website = website;
        insert account;
        return account.Id;
    }
}

I'm testing it through https://www.hurl.it/ and there is an authentication section with username and password. My question is how can I check if it is the right combination?

And what would happen if they send me the information through a webservice that's not like that website but just an endpoint to my website? 
Hello, I have a Visualforce page that has lightningStylesheets="true" and when I click 'preview' I see it as a lightning page, but I also have a force.com site that has this Visualforce page and when I open it through the Anonymous Chrome it shows Classic instead of Lightning.

Thanks!
Hello, I've tried everything on this forum but I still can't pass this challenge.
The error is: 
The 'projectRef__c' field is not configured correctly as an Indirect Lookup field.

Here is how I configured the External Object:

User-added image
On some comments it was said to change the name of projectRef to External ID but it didn't work either.

Thanks in advance
Hello, I have created a Visualforce Page that is a form to insert a new record of a Custom Object. I have tried using <apex:pageblocksection> and <apex:pageblocksectionitem> but it doesn't work.

I have a Help Text on this field and if I try to insert a new record on salesforce it shows me the help text, but on visualforce it just shows the image but when I go over with the mouse nothing happens.
There is no data loaded on the page at the beggining, then I refresh it a couple of times to show/hide some fields.

I read on https://developer.salesforce.com/forums/?id=906F000000096rTIAQ something about the onload function but I have no idea about that.

I just want to use the Help Text that I put on the field on Salesforce on my Visualforce page.

PD: I have showHeader="true" and tried setting it to false but nothing happens.

Thanks!
Hello, let's say I have a custom object like Account. I receive a cvs file with the name and other data fields and an external ID.

I want to update if the Account already exists, or create a new Account if it doesn't.

I thought of putting all of the External IDs of the file in a list and then use Set or Map and then do a query to get the Accounts that have these External IDs so I don't do a new Account.

The problem is I don't know where to start :(

Can anyone give me a hand with a simple example?

I don't want to do a query inside the loop because I understand it's a bad practice.

Thanks!
Hello, I'm just starting to use Salesforce.
Let's say I've got a website with a form to insert a Contact. After the contact is inserted on my web, I want to send a JSON to Salesforce so this Contact is inserted on the Contact Object.

I don't quite understand what I need on my website to communicate with Salesforce.

Thanks!!
public with sharing class AccountsController 
{
	@AuraEnabled
    public static List<Account> getAccounts()
    {
        return[SELECT Id, Name, Industry , Type, NumberofEmployees, TickerSymbol, Phone FROM Account];
    }
}

 
Hi, 

I need help to do a DML operation with external id field. I am using the below syntax, but it is throwing an error

Schema.SObjectField unique_projectuser = CC_Project_User__c.Fields.Unique_Project_User__c;
 List<Database.UpsertResult> res = Database.Upsert(projectUsers_List, unique_projectuser ,false);  

Error: getErrors=(Database.Error[getFields=();getMessage=Unique_Project_User__c not specified;getStatusCode=MISSING_ARGUMENT;]);getId=null

ANy help here is greatly appreciated. Thanks 
I'm receiving the following error on challenge #6 of the Lightning Superbadge:

Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Delete failed. First exception on row 0 with id 0035000002hUBgRAAW; first error: DELETE_FAILED, Your attempt to delete Sam the ninja could not be completed because it is associated with the following adventure packages.: null, null : []

Looking at the Developer Console, it looks like the code which checks the system is forgetting to delete the Adventure Package records before deleting the Contact. Has anyone else run into this issue?

Thank you!
Background of the issue:
We have just started exploring the option of using OMNI Channel for our service cloud CSR user. I have turned on omni channel settings in my Dev org. I have set up the routing and service channel configurations for omni channel for a custom object. In our org, for contacts we have custom sharing settings (On contact object, we have a restricted flag, if a contact is restricted, then only certain roles can see that contact). On the custom object record, we have a lookup to contact, with OMNI Channel when we assign the custom object record to a Queue, if that custom object record's contact is restricted then that Queue user is not supposed to accept that custom object record.

Question:
When the user clicks "Accept" in OMNI Channel, we wrote a trigger on the custom object record, to control the change of owner, however, OMNI Channel Agent's accept does not fire the trigger on the custom object for which the owner is getting changed.

I would like to undestand, why the trigger on the custom object record does not fire, when the owner is changed from Queue to a User, when the User clicks "Accept" through OMNI Channel.

Is there any way to write trigger on Agentwork object? Please advice..
 

Hi,

 

i have created a apex RestResource class as mentioned in below link in my org.

but when i try to call this resorce from POSTMAN(rest lient in chrome) its giving me error as 

 

[
{
"message": "Session expired or invalid",
"errorCode": "INVALID_SESSION_ID"
}
]

 

the link is : http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_restrequest.htm

 

i tried by using the URL : https://ap1.salesforce.com//services/apexrest/Account/0019000000B8nwt

 

and provided 1 parameter

Authorization : my session id which i got it from userInfo.getSessionID() method.

 

please let me know if anyone has worked on it and what is the mistake iam doing

 

Thanks

 

Regards

Rakesh

 

 

Hi Team, I want to display the help text in visualforce page but i tried the below code but i am getting so error message.
{!$ObjectType.Request__c.fields.Name__c.InlineHelpText}
Please let me know why I am getting so many error message and please let me know the solution to display help text in visualforce page. Thanks in advance.
  • August 01, 2011
  • Like
  • 0