• Vidya D
  • NEWBIE
  • 15 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 15
    Replies
I am trying to load data that consists of Asian characters as well as , between the text.
I followed instruction to create UTF-8 file as per below link
https://help.salesforce.com/apex/HTViewHelpDoc?id=faq_import_dataloader_specialchars.htm&language=en_US
With this approach excel save as unicode surrounds text with comma in Quotes.  Then Dataloader fails to load this with error "Found unescaped quote" 

I created work around by changing , with ; in excel, save as unicode and in text editor replace ; with ,. Then follow the steps to save as UTF-8.
 This file fails with number of data columns (3)  exceeds the number of columns in the header.

 Has anyone able to load the data with , within text and special characters? 





 
Is it possible to get CustomLabel value dynamically using javascript function variable

for e.g

var abcd = function(pageName, label1) {
       $linkLets.take({
            pageId: pageName,            
            label:{!JSEncode($Label[label1])}

            
       });        


I am getting error label1 as unknown property.

Also came across this idea
https://success.salesforce.com/ideaView?id=08730000000hhVGAAY

Just want to confirm it is not possible.

 
My Org has two different profiles. One Profile can create some  materials required by Org and 2 nd profice consumes that org by associating material with account through junction object - VF page and cotroller extension.  When I use 2nd profile and and access Account through UI, I get expected error message insufficient privileges. 

I want to write test case to test insufficient privileges by creating 2 different users one for each. But I am not able to simulate the test method. Now I am wondering is it possible to write test method to test insufficient privileges?
I have ControllerExtension for Account’s child Object. Obj1   Profile A  User UA has permission to CRUD for Account and OBJ1. Profile B  - User UB doesn’t have access to ControllerExtension as well as VF page.  When I login as user UB in developer sandbox, and test through UI, I get insufficient privileges for page using  ControllerExtension. This is as expected.
I have written test class to test this scenario. But it doesn’t give me this error.

But if I use Chatter Free profile to create runAs User , I get the exception in catch part.
Is there way to catch or debug insufficient privilages?

How to write test class to test User Privileges?
@isTest
    public static void testUserAccess(){
        // create test user
         User runUsr =  [select name, id, profileId from User where id = '005j000034BMsou' limit 1];
        //TestExtension.createProfileBUser();
//As this doesn’t work, I am directly retrieving user who as profileB
        System.debug(' runUsr ' + runUsr);
   // This prints me correct user         
        System.runAs(runUsr){
            user rrU = [select name, id, profileId                             from user
                        where id = :UserInfo.getUserId()];
            System.debug('runUsr rru' + runUsr + ' ' + rrU); 
            System.assertEquals(runUsr,rrU) ;              
            //Both above users are matching
            
// Create Account        
            Account account = new Account(name='testAccount');
            insert account;
            // I expect error here but no error
            // Create the controllerExtension and click cancel
            ApexPages.StandardController std =  new ApexPages.StandardController(account);
            CCExtension ctrl;
            PageReference page;
            try{
                ctrl = new CCExtension (std);
                System.debug(' Created ctrl ' + ctrl );
                System.AssertEquals(null,ctrl);
                page = ctrl.save();
            } catch(Exception e){
                System.debug(' CTRL creation Exception e ' + e);
// No error message here too
            }
             System.assertEquals(null, page);
// this passes - is this the way to write the test?
            if(ApexPages.hasMessages()){
                System.debug('There are error messages');
                for(ApexPages.Message msg:ApexPages.getMessages()){
                    System.assert(true, ' Error messages ' +  msg );
                }
            }
            
        }
I have created wrapper class with two Object having lookup relation. While traversing through standardSetController user may update vaules of the look up object. If lookup Object has values entered or updated or removed, corresponding insert/update/delete should happen on the single save. What I am running into issue, if child object is new - doesn't have id, then VF page is not sending modified data to controller.

Is there any example or sample code available to do with wrapper class and standardsetController?
Where can I find information regarding computer use for Programming assignment. 
I need to know  the computer / camera requirement for  the programming assignment.

What are the Biometric requirements for doing assignment? Do I need external camera? 
Do I have to use same laptop/computer throughout assignment?
Is IDE allowed to use?

I couldn't find answer to this question on FAQ or even reply fo the open case.

 
Lookup field from custom Dialog in IE11 on tablet throws error - 'Unable to get property 'lookupPick' of undefined or null reference.'

I receive unable to get property for TAB, and other Salesforce properties.
Here is the underlying link / salesforce code.

cs10.visual.force.com/_ui/common/data/LookupResultsFrame?lkfm=j_id0%3Aform&lknm=j_id0%3Aform%3Aj_id15%3ApocTable%3A0%3ApocUser&lktp=StandardUserLookup&lksrch=Ry&go=+Go%21+#

onclick="top.window.opener.lookupPick('j_id0:form','j_id0:form:j_id15:pocTable:0:pocUser_lkid','j_id0:form:j_id15:pocTable:0:pocUser','','005J0000001OUN9','Ryan ','','')">
I would like to know which all operation it is guarenteed that System.Isbatch() will be true. 

Data inserted from dataloader or other data migration tools / third party software.
Batch Apex?
Any other API?


 I was wondering if anyone is really taking advantage of large (500 -800) number of fields supported by Salesforce on each table/custom object. I come across  reluctance from designer / developers  to come out of relational data model concept.  I would like to know more about large application schema design.

 

 

 

I am trying to parse Date string to Date data type


While executing Anonymous code below 
Date Birthdate = date.parse('09-05-1954');
System.debug('Birthdate '+ Birthdate); 

throws exception
6:11:11.041 (41552000)|EXCEPTION_THROWN|[1]|System.TypeException: Invalid date: 09-05-1954
16:11:11.041 (41707000)|FATAL_ERROR|System.TypeException: Invalid date: 09-05-1954

But Date String with Slash works fine
Date Birthdate = date.parse('09/05/1954');
System.debug('Birthdate '+ Birthdate); 

Output

16:15:26.160 (160415000)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex
16:15:26.161 (161357000)|USER_DEBUG|[2]|DEBUG|Birthdate 1954-09-05 00:00:00

This happens only for US locale.

 

Any idea - how to solve this?

Can we calculate total number of records with Warranty Status = 'INACTIVE' in the formula field. If NO could you guys please suggest me a best way to do it?
Hi,

I am having problems setting up a custom controller.  I was able to create one based on a custom object with no problem, but I can't seem to get this to work.  I have tried twice and followed the Trailhead example. Information is below.  Thanks for any help.

-> APEX CLASS

public class CudaController {
    private String sortOrder = 'Sales_Order__C';
public List<Lead> getLeads() {
List<Lead> results = Database.query(
        'SELECT LastModifiedDate, Sales_Order__C, FirstName, LastName, Description' +
        'FROM Lead ' +
        'ORDER BY ' + sortOrder + ' DESC ' +
        'LIMIT 10'
    );
    return results;
}
}

-> PAGE

<apex:page controller="CudaController">
    <apex:form >
        <apex:pageBlock title="Cuda" id="Lead_list">
            <!-- Lead_list -->
            <apex:pageBlockTable value="{! Leads }" var="Lead">
            <apex:column value="{!Lead.LastModifiedDate}"/>
            <apex:column value="{!Lead.Sales_Order__c}"/>
            <apex:column value="{!Lead.FirstName}"/>
            <apex:column value="{!Lead.LastName}"/>
            <apex:column value="{!Lead.Description}"/>
        </apex:pageBlockTable>            
        </apex:pageBlock>
    </apex:form>
</apex:page>

-> ERROR ON PAGE

unexpected token: ORDER 
An unexpected error has occurred. Your development organization has been notified.

-> EMAIL WITH ERROR THAT IS SENT WHEN I VIEW THE PAGE

Visualforce Page: /apex/CudaControllerPage

caused by: System.QueryException: unexpected token: ORDER

Class.CudaController.getLeads: line 4, column 1
             
Hello,

I have multiple problems. But before that I want to share the code that I wrote.

Apex Class:
public with sharing class meetingAttendeeExtension {
    public List<MeetingAttendees__c> listMeetingAttendee {get; set;}
    MeetingAttendees__c meetingAttendee = new MeetingAttendees__c();
    public String KARId = apexpages.currentpage().getParameters().get('id');
    ApexPages.StandardController controller;
    public meetingAttendeeExtension(ApexPages.StandardController controller) {
        listMeetingAttendee = new List<MeetingAttendees__c>();
        listMeetingAttendee.add(meetingAttendee );
        controller = this.controller;
    }
    public void addMeetingAttendee(){
        MeetingAttendees__c meetAtt = new MeetingAttendees__c();
        listMeetingAttendee.add(meetAtt);
    }
    public PageReference saveMeetingAttendees() {
        for(Integer i=0; i<listMeetingAttendee.size(); i++)
        {
            insert listMeetingAttendee;
        }
        return new PageReference('/' + Schema.getGlobalDescribe().get('Key_Account_Report__c').getDescribe().getKeyPrefix() + '/o'); // this works but not what I am trying to acheive
        }
    public PageReference cancel(){
        return new PageReference('/' + controller.getId() );// returns null
    }
}

Visualforce Page: 
<apex:pageBlock >
             <apex:pageBlockSection title="Add Meeting Attendees" columns="1">
             <apex:pageBlockTable value="{!listMeetingAttendee}" var="meetAtt" id="customTable">
             <apex:column headerValue="Key Account Report Name">
                 <apex:inputField value="{!meetAtt.Call_Report__c}"/>
             </apex:column>
             <apex:column headerValue="Attendee Type">
                 <apex:inputField value="{!meetAtt.Attendee_Type__c}"/>
             </apex:column>
             <apex:column headerValue="Attendee Name">
                 <apex:inputField value="{!meetAtt.Attendee_Name__c}"/>
             </apex:column>
             </apex:pageBlockTable>
             </apex:pageBlockSection>
             <apex:pageBlockButtons >
                 <apex:commandButton value="Add Account Row" action="{!addMeetingAttendee}" rerender="customTable"/>
                 <apex:commandButton value="Save Meeting Attendees" action="{!saveMeetingAttendees}"/>
                 <apex:commandButton value="Cancel" action="{!cancel}" immediate="true"/>
             </apex:pageBlockButtons>
             
         </apex:pageBlock>
     </apex:form>
</apex:page>

Now there are following questions that I am trying to find but unable to implement.
Meeting_Attendees__c is child to Key_Account_Reports__c(Master Detail Relationship).
1. when I click "Add New Attendees", the name of Parent Key Account report does not poppulate by itself (how to do this)
2. controller.getId() gives me null, i am expecting to get parent ID here, is this right way ?

Solving above will help me acheive following.
1. Auto populate name of parent object so that user need not select it from the huge liste of Key Account Reports
2. create buttons which will navigate user to parent record, detail view page.

I found previous post related  to this https://developer.salesforce.com/forums/#!/feedtype=SINGLE_QUESTION_SEARCH_RESULT&id=906F000000090tcIAA

but this does not help.

Please suggest some way to acheive above.

Regards, 
Nitin V Palmure
I need assistance with the below trigger, the line which i bold and underlined.When i insert bulk record using dataloader.io for all records v.Pending_Hardware_Installations_Order__c = ordr.Left_Hardware__c; is to reflect the updated ordr.Left_Hardware__c ,but for all records its not reflecting the updated ordr.Left_Hardware__c to the v.Pending_Hardware_Installations_Order__c .
trigger InstalledHardware on Vehicle_Details__c (before insert)
{
    Set<Id> setOrderIds = new Set<Id>();
    Map<Id,Order> mapIdWithOrder = new Map<Id,Order>();
    for(Vehicle_Details__c V:trigger.new){
        if(v.Order__c != null){
           setOrderIds.add(v.Order__c); 
        }
    }
    if(!setOrderIds.isEmpty()){
        for(Order ordr :[select Order_Number__c,Finished_HardWare__c,Left_Hardware__c,Total_Hardware_Type_Ordered_Products__c from Order where id IN :setOrderIds]){
            mapIdWithOrder.put(ordr.Id,ordr);    
        }
    }
    for(Vehicle_Details__c V:trigger.new){
        if(v.Order__c != null && mapIdWithOrder != null && mapIdWithOrder.get(v.Order__c) != null){
           Order ordr = mapIdWithOrder.get(v.Order__c);
           v.Pending_Hardware_Installations_Order__c = ordr.Left_Hardware__c;
           v.Total_Hardware_Quantity_for_Order__c = ordr.Total_Hardware_Type_Ordered_Products__c; 
           ordr.Finished_HardWare__c = ordr.Finished_HardWare__c + V.Total_Hardware_Installed__c;
           mapIdWithOrder.put(v.Order__c,ordr)
        }
    }
    if(mapIdWithOrder.values().size() > 0)
    {
        update mapIdWithOrder.values();
    }
}
I am receiving the Too Many SOQL Queries error sporadically in Production.  Each time the error refers to a different trigger and comes inconsistently after different processes with different users.  None of the triggers referenced have SOQL queries in a loop.  Any ideas for debugging.
Hello-

I know you can normally use a controller to do this - but I want to pass values from my custom button to my VF page.  AS of right now - I am unable to get the Priority field to show "High."

Any help?

Here is my custom button:
/apex/EscalateIncident?&id={!Incidents__c.Id}&00Nn0000000Pp0u=High&retURL=%2F{!Incidents__c.Id}



Here is my VF Page:
<apex:page standardController="Incidents__c">
    <apex:form >
        <apex:pageBlock title="Escalation Notes: {!Incidents__c.Name}">
            <apex:pageBlockSection title="Escalation Notes" columns="1">
                <apex:inputField value="{!Incidents__c.Escalation_Notes__c}"/>
                <apex:outputField value="{!Incidents__c.Priority__c}"/>
                
            </apex:pageBlockSection>
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>
                <apex:commandButton action="{!cancel}" value="Cancel"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 
I have ControllerExtension for Account’s child Object. Obj1   Profile A  User UA has permission to CRUD for Account and OBJ1. Profile B  - User UB doesn’t have access to ControllerExtension as well as VF page.  When I login as user UB in developer sandbox, and test through UI, I get insufficient privileges for page using  ControllerExtension. This is as expected.
I have written test class to test this scenario. But it doesn’t give me this error.

But if I use Chatter Free profile to create runAs User , I get the exception in catch part.
Is there way to catch or debug insufficient privilages?

How to write test class to test User Privileges?
@isTest
    public static void testUserAccess(){
        // create test user
         User runUsr =  [select name, id, profileId from User where id = '005j000034BMsou' limit 1];
        //TestExtension.createProfileBUser();
//As this doesn’t work, I am directly retrieving user who as profileB
        System.debug(' runUsr ' + runUsr);
   // This prints me correct user         
        System.runAs(runUsr){
            user rrU = [select name, id, profileId                             from user
                        where id = :UserInfo.getUserId()];
            System.debug('runUsr rru' + runUsr + ' ' + rrU); 
            System.assertEquals(runUsr,rrU) ;              
            //Both above users are matching
            
// Create Account        
            Account account = new Account(name='testAccount');
            insert account;
            // I expect error here but no error
            // Create the controllerExtension and click cancel
            ApexPages.StandardController std =  new ApexPages.StandardController(account);
            CCExtension ctrl;
            PageReference page;
            try{
                ctrl = new CCExtension (std);
                System.debug(' Created ctrl ' + ctrl );
                System.AssertEquals(null,ctrl);
                page = ctrl.save();
            } catch(Exception e){
                System.debug(' CTRL creation Exception e ' + e);
// No error message here too
            }
             System.assertEquals(null, page);
// this passes - is this the way to write the test?
            if(ApexPages.hasMessages()){
                System.debug('There are error messages');
                for(ApexPages.Message msg:ApexPages.getMessages()){
                    System.assert(true, ' Error messages ' +  msg );
                }
            }
            
        }
Hi.

In the VF I used the date format as YYYY-MM-dd in the 
<apex:outputText value="{0,date,YYYY/MM/dd}">
Before the last week of the year it was OK. When the new year falls in the  last week of Decemeber comes the issue.
For example
2014:
S   M  T  W Th F Sat
28 29 30 31 1   2 3

In the above calendar 1st Jan of 2015 falls in the Thurusday.So when I viewd the records of 28,29,30 of December 2014 It showed as
2015-12-28
2015-12-29
2015-12-30
2015-12-31

After that I came to know that
@"YYYY" is week-based calendar year.
@"yyyy" is ordinary calendar year.
http://realmacsoftware.com/blog/working-with-date-and-time

cheers
suresh



 
Where can I find information regarding computer use for Programming assignment. 
I need to know  the computer / camera requirement for  the programming assignment.

What are the Biometric requirements for doing assignment? Do I need external camera? 
Do I have to use same laptop/computer throughout assignment?
Is IDE allowed to use?

I couldn't find answer to this question on FAQ or even reply fo the open case.

 
Lookup field from custom Dialog in IE11 on tablet throws error - 'Unable to get property 'lookupPick' of undefined or null reference.'

I receive unable to get property for TAB, and other Salesforce properties.
Here is the underlying link / salesforce code.

cs10.visual.force.com/_ui/common/data/LookupResultsFrame?lkfm=j_id0%3Aform&lknm=j_id0%3Aform%3Aj_id15%3ApocTable%3A0%3ApocUser&lktp=StandardUserLookup&lksrch=Ry&go=+Go%21+#

onclick="top.window.opener.lookupPick('j_id0:form','j_id0:form:j_id15:pocTable:0:pocUser_lkid','j_id0:form:j_id15:pocTable:0:pocUser','','005J0000001OUN9','Ryan ','','')">
I would like to know which all operation it is guarenteed that System.Isbatch() will be true. 

Data inserted from dataloader or other data migration tools / third party software.
Batch Apex?
Any other API?


the Apex class:

public with sharing class AcctActivityList{
  
    public Account acct {get; set;}
    public List<ActivityHistory> ClosedTasks {get; set;}
    string mail = 'mail';
  
    public AcctActivityList(ApexPages.StandardController stdcontroller) {
        //get account
        acct = (Account)stdController.getRecord();
        //get activity history - can't query activity history directly, just in a subquery against another object

        SObject[] ActivityHistory = [Select id, (select Id, AccountId, Account.Name, ActivityDate, ActivityType, Description, OwnerId, Subject,
                                        LastModifiedDate, IsTask, WhatId, WhoId from ActivityHistories where
                                        (ActivityType !='Email' or Subject.contains('email')) ORDER by ActivityDate DESC)
                           from Account where Id =: acct.id];
      
        ClosedTasks = (List<ActivityHistory>)ActivityHistory.get(0).getSObjects('ActivityHistories');
      
    }
}


Why is my string.contains filter not working (i.e. why can't I save the code)?
When I try to save, I get the error: unexpected token: 'email'. The same is true if the filter is Subject.contains('email') == false.

I've seen this string class referenced various places around the web and it's still not working. I also tried reverting to API 27 (it was on 29) in case there was a bug in that API. No go.
  • March 17, 2014
  • Like
  • 0
I've got an object defined with an "external ID" field (in this case, email address).

We've got code that takes real-world values and upserts them into this object.  We don't bother querying for matches first - we just upsert the given values, knowing that the object they will either insert (if new) or update (thus resolving to the correct ID).  Either way my SObjects are guaranteed to have a valid ID post-upsert.

However, if I run enough processes in parallel, I'll get an upsert error:

EXCEPTION: Upsert failed.  First exception on row 0; first error:
DUPLICATE_VALUE, duplicate value found: i__FullAddr__c duplicates value on record with id: a0T700000003bX4


I'll investigate using the Database.upsert() method to retry the upsert on failure; hopefully that will fix the problem.

Am I smoking crack to think that upsert should be an atomic operation?  This is empirically not the case - we've clearly got interleaved upserts - but is this a bug or a "feature"?
  • May 01, 2008
  • Like
  • 1