• shweta chadha 4
  • NEWBIE
  • 40 Points
  • Member since 2016


  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 11
    Replies
Hello,

I am creating the html template in Salesforce and below is value i am fetching from one field that is building address. However, i just need the building number from the entire address. Below is the scenario.
“Václavské náměstí 785/28, P1 - Alfa Building”, this is the text and I want to extract the only the number i.e 785/28. But the thing is the numbers before and after the ‘/’ varies it can be more than 3 or 2 digits. Trim Left and Right work but can't seem to specify the values dynamically. 

Thanks, Shweta
Hi,

How to create trigger files dynamically for custom objects via apex?

Thanks, Shweta
Hello,

I am working on the product which needs to be installed in the App exchange through manage package. I need to determine how to create trigger files for custom object via Apex? Can someone please help me on this?
On Opportunity, we want to close a Commission field if the opportunity status is Closed Won or Closed Lost. This new field (formula field) should look like the filter conditions from a Lookup Field creation.
Can someone help me how we can achieve this?
Need to update the commission field based on some calculations. I am using the future method to update the commission field. Commission field is getting updated immediately in lightening as expected. However, in salesforce classic, I need to refresh the page manually then only it reflects me the updated commission value. Can someone please help me to provide the solution?
Hello,

I need to write a trigger to update the value of Related to company field ( if it is null only) on the task object based on the related to contact field value. Please help me how can I achieve this.

Thanks, Shweta
here is my code:

trigger DeleteContact on Contact (after delete) {
    if(trigger.isbefore)
    {
        
        if (trigger.isdelete)
        {
             set<id> idset = new set<id>();
        
        for (Contact c : Trigger.old)
    {
        idset.add(c.Id);
    }
    
         
   List <Contact_Relationship__c> CR = [Select id from Contact_Relationship__c where id IN:idset];
   
           delete CR;        }
    }}
 
Hello,

I am going through the "Use Bulk API" through trailhead and creating the rest explorer connection using session id, everything seesm to be intatc though unsure why it is throwing an error as""exceptionCode":"InvalidSessionId","exceptionMessage":"Unable to find session id"}". Here is my code:

Request Headers: 
Content-Type: application/json; charset=UTF-8
Accept: application/json
X-SFDC-Session:
00D90000000uCn4!AREAQB0wLmf61zu6bgGqGk2u3X0abJKxDdgIT2EsV7CewXQgWMzHObOauNzDeX.fypHNiJmjPY4SPi.qSCSmf01lRuGn83jt

Request Body:

{
"operation": "insert",
"object"   : "Account",
"contectType" : "JSON"

}

Please help.
On Opportunity, we want to close a Commission field if the opportunity status is Closed Won or Closed Lost. This new field (formula field) should look like the filter conditions from a Lookup Field creation.
Can someone help me how we can achieve this?
Hello,

I need to write a trigger to update the value of Related to company field ( if it is null only) on the task object based on the related to contact field value. Please help me how can I achieve this.

Thanks, Shweta
Hello,

Please find the code below and guide me.
public class Task17 {
    public Map<String, schema.SObjectType> allObjects {get;set;}
    public List<SelectOption>	objNames	{get; set;}
    public String objName {get; set;}
    public String selectedName	{get; set;}
	
    public Task17(){
        list<selectoption> objNames = new List<selectoption>();
        allObjects = schema.getGlobalDescribe();
        list<string> allNames = new list<string>(allObjects.keySet());
        //allNames.sort();
        system.debug('line 19'+allNames);
            for( String key1 : allNames){
                objNames.add(new SelectOption(key1,key1));
            }
        system.debug('Line22'+objNames);
        
    }    
}

VF page is below.
<apex:page controller="Task17" >
    <apex:form>
    	<apex:pageBlock>            
        	Please Select the obj
            <apex:selectList value="{!selectedName}">
            	<apex:selectOptions value="{!objNames}"/>
            </apex:selectList>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Pick list is not displaying.  Help..
 
Hi friends
i want a trigger code for this
When a contact is made primary(1) the city of the contact should be updated in the Account’s city(3) field. User-added image
here is my code:

trigger DeleteContact on Contact (after delete) {
    if(trigger.isbefore)
    {
        
        if (trigger.isdelete)
        {
             set<id> idset = new set<id>();
        
        for (Contact c : Trigger.old)
    {
        idset.add(c.Id);
    }
    
         
   List <Contact_Relationship__c> CR = [Select id from Contact_Relationship__c where id IN:idset];
   
           delete CR;        }
    }}
 
Hello,

I am going through the "Use Bulk API" through trailhead and creating the rest explorer connection using session id, everything seesm to be intatc though unsure why it is throwing an error as""exceptionCode":"InvalidSessionId","exceptionMessage":"Unable to find session id"}". Here is my code:

Request Headers: 
Content-Type: application/json; charset=UTF-8
Accept: application/json
X-SFDC-Session:
00D90000000uCn4!AREAQB0wLmf61zu6bgGqGk2u3X0abJKxDdgIT2EsV7CewXQgWMzHObOauNzDeX.fypHNiJmjPY4SPi.qSCSmf01lRuGn83jt

Request Body:

{
"operation": "insert",
"object"   : "Account",
"contectType" : "JSON"

}

Please help.
I've finally completed step 4. Test automation logic. 

It took me long, because of incorrect requirement in spec. 
The requirement is: 
When an existing maintenance request of type Repair or Routine Maintenance is Closed, you create a new maintenance request for a future routine checkup. [...] The Subject should not be null and [...]

Unfortunatelly test checks something completelly different. See below line from error log:  
Execute Anonymous: System.assertEquals(402, [select count() from Case where subject like '%AMC Spirit%']);
Moreover, the error information from within Trailhead page suggests, that this is a problem with bulk processing. 

<joke> So, if you want to finish step 4 of those badge you need to set the subject to AMC Spirit in case created by your trigger </joke>