• David Hales
  • NEWBIE
  • 409 Points
  • Member since 2017

  • Chatter
    Feed
  • 11
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 98
    Replies
Hi Guys.

I am looking to get a substring before a specific character from a string .
For Example:
If Strings are

string s= 'gangadhar@SHAKTIMAAN';
String s2= 'raj@NAGRAJ';

i need s as gangadhar from first string and raj from second string.

Please guide.
 
as we know the reords we are going to insert in test class are dummy records and not gonna to insert in our org , but is it required to test on actual  
records while writing test class.
Hi All,
One of the Interviewer asked to me that
'I want to develop a visual force page,it will show the list of accounts,and i should be able to edit the account name and save it .For all accounts(Bulk Updating) or One Account, and i dont want to write any code..........You can you any method.......How can i achive that...............'?
How can can i achive this .............
Thanks in advance.............
 
Hi everyone,

I'm an experienced admin, but am very new to development (just learning random bits here and there, as I don't have enough time in my job to do this the proper way.) I'm trying to deploy the code below but am not able to write a test that the Salesforce org will accept as >0%. I have tested all the functionality I need and am confident this won't break anything.

If someone could help create some very simple test coverage so I can push this to production, I'd be incredibly grateful. Thank you!

New Opportunity Trigger: 

trigger NumberofContactRoles on Opportunity (before update, after undelete) 

{
Set<Id> opportunityIds = Trigger.newMap.keySet();
List<OpportunityContactRole> contactRoles = [
        SELECT OpportunityId, IsPrimary
        FROM OpportunityContactRole
        WHERE OpportunityId IN :opportunityIds
];

Set<Id> opportunitiesWithContactIds = new Set<Id>();
Map<Id, Integer> contactRoleCount = new Map<Id, Integer>();

for (OpportunityContactRole contactRole: contactRoles) {
    if (contactRole.IsPrimary == True) {
        opportunitiesWithContactIds.add(contactRole.OpportunityId);
    }
    if (contactRoleCount.containsKey(contactRole.OpportunityId)) {
        contactRoleCount.put(contactRole.OpportunityId,
                contactRoleCount.get(contactRole.OpportunityId) + 1
        );
    } else {
        contactRoleCount.put(contactRole.OpportunityId, 1);
    }
}

for (Opportunity oppty : system.trigger.new) {
    if (contactRoleCount.containsKey(oppty.Id)) {
        oppty.Number_of_Contact_Roles_Assigned__c = contactRoleCount.get(oppty.Id);   
    } else {
        oppty.Number_of_Contact_Roles_Assigned__c = 0;
    }
}
}
Error:-
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: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, The record couldn’t be saved because it failed to trigger a flow. A flow trigger failed to execute the flow with version ID 3017F000000gR4k. Flow error messages: An unhandled fault has occurred in this flow
An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information. Contact your administrator for help.: []
And in developer console it shows-FLOW_ELEMENT_ERROR The flow failed to access the value for myVariable_current.Account.Type because it hasn't been set or assigned.
this is the code for standard controller = "Forecast__c" to get the field Picklist1__c
<div class="slds-form-element__control">
<div class="slds-select_container">
<apex:inputField value="{!Forecast__c.Picklist1__c}" styleClass="slds-select slds-input slds-input--small" />
</div>
</div>
Hello,

I have deleted few fields in sandbox, how can i dilever thm by ant or change set...to say that they are deleted..
thanks for suggestion !
I am writing my first trigger. It involves two objects:
  1. Opportunity (Standard Object)
  2. Holding Object (Custom Object) 
What is supposed to happen is the following:

A name is chosen from a picklist field on the opportunity. Upon save the trigger should go look at the Holding Object object and find that name and pull the email address from that Persons record on the custom object.

Here is screenshot of what I have so far including the error.

User-added image

The actual code is below (in case the above is hard to read):

trigger Opportunity_Adelphic_AE_Email_Trigger on Opportunity (after update, before insert, before update, before delete) {
Opportunity [] opp = trigger.new;
                //Fill in the Adelphic AE email fields based on the person selected from the drop down list. 
                    for(integer i=0;i <opp.size();i++){

                        Set<string> Person = new Set<string>();
                        Person.add(trigger.new[i]. Adelphic_AE__c);

                        
                        if(Person.Size() > 0){
                            map<string, string> DM = new map<string, string>();
                                Holding_Object__c [] DMM = [select Persons_Name__c, Email_Address__c from Holding_Object    __c where Persons_Name__c in: Person ];
                                    for(Holding_Object__c lzip: DMM){
                                        DM.put(lzip.Persons_Name__c, lzip.Email_Address__c);
                                    }
                                    for(Holding_Object__c h: DMM){
                                        trigger.new[i]. Adelphic_AE_Email__c = DM.get(trigger.new[i]. Adelphic_AE__c);
           }
}

The error I am receiving is: "Compile Error: unexpected syntax: 'mismatched input '<EOF>' expecting RCURLY' at line 20 column 1.

Any feedback and guidance would be appreciated.

UVC has separate business requirements for consumer and business opportunities. The sales team works both of opportunities. The app builder created two record types on the Opportunity object. What action can be performed? select 2.

a. Create unique opportunity stages by sales process
b. Specify a different page layout by sales process.
c. Enable field validation by sale process.
d. Prevent access to secure data fields by sales process.

One answer is Option B as record types we need to assign different layouts. what is the other best option which could be the answer?
Is there a way to generate a unique contact ID in Marketing Cloud upon import of new contacts?
Hi All,

Created the following simple visualforce page, and then a tab based on this page. Enabled lightning experience and then visited the tab (App Launcher -> Other Items -> this tab). The option "Available for Salesforce mobile apps and Lightning Pages" is also enabled.

The output shows Theme3 instead of Theme4d. What am I doing wrong?

<apex:page showHeader="true" >
{!$User.UITheme}
<br/>
{!$User.UIThemeDisplayed}
</apex:page>
 
Hi All,

In my Data Loader settings Batch Size is 200 and while updating the data(.csv with 45 records) i got an error MiB_Rules: System.LimitException: Too many SOQL queries: 101.
I updated batch size to 1 and performed the same action and data load update process went through. Not sure how batch size is impacting the number of SOQL queries.

Can someone please clarify out of your own experience.

Thank you!!
Hi Folks, 

Want to search account on Visualforce page and based on Selected Option. 
Ex : Name, Phone, Email.
Above there parameters need to add like in a picklist on Visualforce page and there should be an option to enter some characters and the search Button. 
Then based on selected option and entered value data should query and display. 
Please help. 

Thanks in Advance.
  • December 29, 2017
  • Like
  • 0
Hi Guys.

I am looking to get a substring before a specific character from a string .
For Example:
If Strings are

string s= 'gangadhar@SHAKTIMAAN';
String s2= 'raj@NAGRAJ';

i need s as gangadhar from first string and raj from second string.

Please guide.
 
Hi All,

I have two picklist fields in vf page, i want to retain field dependency between the two in my page. I am using standard controller and no pageblock component used. Any ideas?

Thanks.
  • August 22, 2017
  • Like
  • 0
Hey All, 
I am building a community and wanted to allow external users access to create reports directly from the partner community, but do not know how to add the report builder.  Note: We are using the partner central template, but not wedded to it.  From the documentation (page 436 and 452) this seems possible. Does anyone know how to add this function to the community? 

Cheers,

Vince
Hi, i have a two picklist value one has a list of object and other is a list of the fields related to object pick list(more than one field can be selected)
If a object is selected and related field are selected it should create a table with records for a particular object.
This is now working for one field in the Particular object. 
when I select the multiple fields for an object it shows error 
Exception: Invalid field name for SObject Account 

Below is vf page  for same :
<apex:page controller="objectController1"  showHeader="false" sidebar="false" > 
    <head>
        <apex:stylesheet value="{!URLFOR($Resource.LIGHTNING_RESOURCE_NAME, 'assets/styles/salesforce-lightning-design-system-vf.css')}" />
    </head>
    <apex:form > 
        <apex:pageBlock > 
            <apex:pageBlockSection > 
                <apex:pageBlockSectionItem > 
                    <apex:outputlabel value="Object Names :"/> 
                    <apex:actionRegion > 
                        <apex:selectList value="{!selectedObject}" size="1"> 
                            <apex:selectOptions value="{!ObjectNames}"/> 
                            <apex:actionSupport event="onchange" rerender="myFields"/> 
                        </apex:selectList> 
                    </apex:actionRegion> 
                </apex:pageBlockSectionItem> 
                <apex:pageBlockSectionItem > 
                    <apex:outputlabel value="Field Names :"/> 
                    <apex:outputPanel id="myFields"> 
                        <apex:actionRegion > 
                            <apex:selectList value="{!selectedField}"  size="10" multiselect="true"> 
                                <apex:selectOptions value="{!ObjectFields}"/> 
                            </apex:selectList> 
                        </apex:actionRegion> 
                    </apex:outputPanel> 
                </apex:pageBlockSectionItem> 
                <Center>
                    <apex:commandButton value="Fetch Fields" action="{!Fetch}"/>
                </Center>
            </apex:pageBlockSection> 
        </apex:pageBlock> 
           <apex:outputPanel layout="block">
                <apex:pageBlock >
                    <apex:pageBlockSection >
                        <apex:pageblockTable value="{!lstobj}"  var="querydata">
                            <apex:repeat value="{!fnlFields}" var="coldata">
                            <apex:column value="{!querydata[coldata]}">
                             </apex:column>
                                </apex:repeat>
                        </apex:pageblockTable>
                    </apex:pageBlockSection>
                </apex:pageBlock>
            </apex:outputPanel>   
    </apex:form> 
</apex:page>
Below is Controller for the Same :
 
public class objectController1{
    public Map <String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
    public String selectedObject {get; set;}
    public String selectedField {get; set;}
    public String picklistValue {get; set;}
    public List<sObject> lstobj {get; set;}
    public List<String> lstfields {get; set;}
    public List<String> fnlFields {get;set;}
    public List<SelectOption> fieldNames {get; set;}
    public List<wrapData> bindData {get;set;}
    
    Public objectController1(){   
        selectedObject ='account';
        //system.debug('HI This is fields'+selectedField );
    }
    
    public List<SelectOption> getObjectNames(){
        List<SelectOption> objNames = new List<SelectOption>();
        List<String> entities = new List<String>(schemaMap.keySet());
        entities.sort();
        
        for(String name : entities){
            objNames.add(new SelectOption(name,name));
        }
        return objNames;
    }
    
    public List<SelectOption> getObjectFields(){
        Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
        Schema.SObjectType ObjectSchema = schemaMap.get(selectedObject);
        Map<String, Schema.SObjectField> fieldMap = ObjectSchema.getDescribe().fields.getMap();
        fieldNames = new List<SelectOption>();
        for (String fieldName: fieldMap.keySet()){  
            fieldNames.add(new SelectOption(fieldName,fieldName));
            //fieldMap.get(fieldName).getDescribe().getLabel();//It provides to get the object fields label.
        }
        System.debug('fieldNames-----'+fieldNames);
        return fieldNames;
    }
    
    
    public PageReference Fetch(){
        
        lstobj = new List<sObject>();
        lstfields= new List<String>();
        bindData = new List<wrapData>(); 
        fnlFields = new List<String>(); 
        //System.debug('Select'+selectedField +'From'+selectedObject);
        String s1= selectedField.removeStart('[');
        String s2= s1.removeEnd(']');
        
        String Query='Select '+s2+' From '+selectedObject;
        
        
        lstobj= Database.query(Query);
        System.debug('List '+lstobj);
        
        lstfields = s2.split(',');
        //System.debug('List of fields '+lstfields);
        for(String s : lstfields){
        
        fnlFields.add(s);
        
        }
        System.debug(fnlFields);
        
        
        //bindData.add(new wrapData(selectedField,lstobj));
        return null; 
    }    
}

Please help me to create a table with more than one field with record 
Thanks in Advance
Rahul



 
as we know the reords we are going to insert in test class are dummy records and not gonna to insert in our org , but is it required to test on actual  
records while writing test class.
Challenge Not yet complete... here's what's wrong: 
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: MLNKBVFT
hi..
m looking for integrating slack with salesforce
wherein slack messages will generate the leads in sf automatically..
Any help will be appreciated!!!

Thanks
Hi All 

I am newbie to Salesforce. I was wondering if anyone can help me ?

How to create a AccountContactRole using trigger ? (When Account and its corresponding Contact is created that contact should become AccountContactRole) 

Your help is much appreciated 
Hi,

I want to update opportunity stage from a parent object on a Professional Edition org.

Could you think, it is possible?

I have try by using the Process Builder with no success. Perhaps I have miss something.

Any other idea?

Thank you.
Hello,

We have Three objects like Account, Contract Asset, Purchase Order.

In An account there are many contract assets which i have to link it to Purchase Order.

example:  There is a Contact Asset with following condition
          Status = Active
          Product family = Banking

      
Then Associate this Contract Asset To Purchase Order, where Product Family field on Purchase Order is Banking.     

Thanks      
 
Hi All,
One of the Interviewer asked to me that
'I want to develop a visual force page,it will show the list of accounts,and i should be able to edit the account name and save it .For all accounts(Bulk Updating) or One Account, and i dont want to write any code..........You can you any method.......How can i achive that...............'?
How can can i achive this .............
Thanks in advance.............
 

Hello,
I am trying to upsert an contact based on a external ID field (x) and that should update/insert another external ID field (y).
So, the upsert inserts the contact based on x. But does not insert the value in the file to the field y, for a new contact.
When I tracked history for the field, y- it reads "deleted <value> from y"

Wouldn't it create the contact with the value?

Regards
Nits

I'm trying to create a notification for when a contact's Account is changed.  I've attempted to create a workflow rule that is evaulated every time a record is created or edited.

The rule consists of simply this:

ISCHANGED( Account.Name )

When I try to check the syntax I get the following error:
Error: The ISCHANGED function cannot reference the Account.Name field.

I R konfuzed....please help.
  • March 07, 2008
  • Like
  • 0