• Nachu RY 4
  • NEWBIE
  • 100 Points
  • Member since 2016

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 21
    Replies
Hi guys,

I have create a custom picklist field called Type_c in a custom object Section_2_Balance_Sheet_c. The Section_2_Balance_Sheet_c object has 2 Record Types called (a) Income and (b) Expenditure. 

Only some of the Type_c values are relevant to each of the record types. How can I only display the relevant piclist values of Type_c based on the Recordy Type? 
HI Everyone

I wanted to display my message in following format can amyone help me out

this is what am trying to do, i dont want to use email templates,please helpme out to fix it.here am attaching(in sample code) how my message wants to loooks like
Subject : Session is NOT Created

Attention:

A session is created for the following Account and opportunity

Account: {!Account.Name}
Contact: {!opportunity.Name}

Thank you

Am trying the above shown messsage in the following format it doesnt works as the above message:--

message.setSubject('Session is NOT Created!');
              String body = 'Attention:';
              body += 'A session is created for the following Account and opportunity';
              body += 'Account: {!Account.Name}';
              body += 'Contact: {!opportunity.Name}';
            message.setHtmlBody(body);

Thanks in Advance
 
Hi,

i Have Two fileds in visualforce page. Those fileds are Prod1 And Prod2 both are test fileds. i want to insert the values of Prod1 fields into Prodf2 fields. Please put me some code on this .
EX: prod1:Test1
Prod2:Test1

Thanks,
Chanti
Hi all,
I want to validate the custom check box before submitting Force.com sites custom vfpage. Can we use standard validation over here...? because i want to make the check box as mandetory. how can we achive this. Can anyone help me over here.

Thanks in advance.
regards,
Suneel.
Hi guys,

I have create a custom picklist field called Type_c in a custom object Section_2_Balance_Sheet_c. The Section_2_Balance_Sheet_c object has 2 Record Types called (a) Income and (b) Expenditure. 

Only some of the Type_c values are relevant to each of the record types. How can I only display the relevant piclist values of Type_c based on the Recordy Type? 
I have a debugged my trigger down to the barest code, and have some strange behavior that I need help to get sorted.

When I create a new Contact using the following trigger:
trigger ContactTrigger on Contact (before insert, after insert) {
	System.debug('1');
	if(Trigger.isBefore) {
	        System.debug('2');
		if(Trigger.isInsert) {
			System.debug(3');
		}
	}
	if(Trigger.isAfter) {
		System.debug('4');
		if(Trigger.isInsert) {
			System.debug('5');
		}
	}
	System.debug('6');
}
I would expect to see a debug statement for each number from 1-6.  However, numbers '4' and '5' do not print, which seems to indicate that the After Insert event is not firing for the Contact object.

If I remove the Before Insert event and create a Contact:
trigger ContactTrigger on Contact (after insert) {
	System.debug('1');
	if(Trigger.isAfter) {
		System.debug('2');
		if(Trigger.isInsert) {
			System.debug('3');
		}
	}
	System.debug('4');
}
Then numbers from 1-4 are correctly output to the debug log (i.e. the After Insert event is firing).

There are no compilation errors, and no errors in the debug logs.  In either version of the trigger, a Contact record is created.  I can validate that After Insert behavior on the Contact object does execute as expected in other sandboxes for my org.

If there's an issue with the above code that would explain the behavior, then I'm missing it.
Hi all,

is there a way to synchronize Salesforce with Outlook so that:
  • If I create an Event on Salesforce, I will retireve it on Outlook
  • If I create an Event on Outlook, I will retrieve it on Salesforce

Thanks in advance :)
I have a two ojects called Patients and Doctors .In that i have field called DOB(date type ).it should send email of birthday wishes to all the records in patients and doctors AUTOMATICALLY on their Birthday
Can anybody help me to write a javascript to check "if the field is blank in a visualforce page" and show the error messages below the field itself? I am new to javascript and not knowing how to write the JS code. Thank you.
HI Everyone

I wanted to display my message in following format can amyone help me out

this is what am trying to do, i dont want to use email templates,please helpme out to fix it.here am attaching(in sample code) how my message wants to loooks like
Subject : Session is NOT Created

Attention:

A session is created for the following Account and opportunity

Account: {!Account.Name}
Contact: {!opportunity.Name}

Thank you

Am trying the above shown messsage in the following format it doesnt works as the above message:--

message.setSubject('Session is NOT Created!');
              String body = 'Attention:';
              body += 'A session is created for the following Account and opportunity';
              body += 'Account: {!Account.Name}';
              body += 'Contact: {!opportunity.Name}';
            message.setHtmlBody(body);

Thanks in Advance
 
Hi Everyone,

I have a button and picklist field .. I have to keep the button active when the status is  A and B  and keep it inactive when the status is C. How can I do this? Do I need to write a trigger? Pls help

Thanks 
Mukul
Hi Friends,

My scenario is When the owner of the record is changed.
Then for the new owner, there are some mandatory fields that the user has to be filled before saving the record.

How do i make the fields required only before saving the records.

How could i achieve this.....?
  • May 09, 2016
  • Like
  • 0
Hi Experts,

We have a apex job in which we are fetching some records(SOQL) in execute method based on the record values retured by start method. But, there are more than 50000 records corresponding to one particular value in an object. My requirement is to send an email alert from batch apex if records returned by SOQL are more than 50K. We know that limit exceptions cannot be handled through try/catch blocks in apex.

Is there any workaround to accomplish this? Please find below mentioned code:
 
global class BatchUpdateOptOutPermissions implements Database.Batchable<sObject>
{
   
   /* Start - Variables */
   /* End - Variables */
   
   /* Start - Constructor */
   global BatchUpdateOptOutPermissions()
   {
        //Do Nothing
   }
   /* End - Constructor */

   global Database.QueryLocator start(Database.BatchableContext BC)
   {
      DateTime dtLast24Hours = System.now().addHours(-24);
      return Database.getQueryLocator('SELECT Id, Channel_Value__c FROM Brand_Permission__c WHERE Permission_Value__c = \'OUT\' AND LastModifiedDate >: dtLast24Hours');
   }

   global void execute(Database.BatchableContext BC, List<sObject> scope)
   {
        List<Brand_Permission__c> lstBP = (List<Brand_Permission__c>)scope;// Casting the scope to list of Brand_Permission__c.
        List<Brand_Permission__c> lstBPToUpdate = new List<Brand_Permission__c>();// List to hold the existing channel permission records which needs to updated.
        Set<String> setPermissionValues = new Set<String>();// Set to hold the channel permission values corresponding to those permissions that are passed from the batch.
        
        //Iterating to hold the channel values
        for(Brand_Permission__c objBP : lstBP)
        {
            if(String.isNotEmpty(objBP.Channel_Value__c))
                setPermissionValues.add(objBP.Channel_Value__c);
        }
        
        if(!setPermissionValues.isEmpty())
        {
            //Fetching the existing permissions which are not opted out in last 24 hours.
            for(Brand_Permission__c objBP : [SELECT ID FROM Brand_Permission__c WHERE Permission_Value__c != 'OUT' AND Channel_Value__c IN : setPermissionValues])
            {
                lstBPToUpdate.add(new Brand_Permission__c(Id = objBP.Id, Source_Time_Stamp__c = System.now(), Effective_Date__c = System.now(), Permission_Value__c = 'OUT', Source_Application__c = 'SharedOptOutSource'));
            }
        }
        
       Database.update(lstBPToUpdate,false);
   }

   global void finish(Database.BatchableContext BC)
   {
        //Do Nothing
   }
}

Thanks,
Pankaj
I've written below trigger:

trigger test_vehicle on Vehicle__c (before insert) {
    for(Vehicle__c gadi : Trigger.New){
        if(gadi.vehicle__c.contains('Honda')){
            system.debug('Honda is already exists');
        }
    }
}

and testing in a developer console like:

Vehicle__c test = new Vehicle__c();
test.Vehicle_Name='testy';
test.user_mail = 'testy@t.com';
insert test;

but getting error, can you please correct me?
Hi I am using URL Rewriting in salesforce, i able to reterive the details using id but i am not able to update the field.
http://**************************************force.com/standardpage?id=00Q2800000HeVCN
global class URLRewriterClass implements Site.UrlRewriter 
{
 //Variable to represent the friendly URLs for pages
 String DIRECTORY = '/standardpage/';
 //Variable to represent my custom Visualforce pages that display page information
 String VISUALFORCE_PAGE ='/standardpage?id=';
 // The first global method for mapping external URL to an internal one
 global PageReference mapRequestUrl(PageReference myFriendlyUrl)
 {
    String url = myFriendlyUrl.getUrl();
    System.debug('******************************'+url);
    if(url.startsWith(DIRECTORY))
    {
       String name = url.substring(DIRECTORY.length(),url.length());
       //Select the ID of the page that matches the name from the URL
       Lead site_page = [select id from Lead where name=:name LIMIT 1];
       System.debug('******************************'+site_page.id);
       //Construct a new page reference in the form of my Visualforce page
       return new PageReference(VISUALFORCE_PAGE+ site_page.id);
    }
    return null;
  }
  // The second global method for mapping internal Ids to URLs
  global List<PageReference> generateUrlFor(List<PageReference> mySalesforceUrls)
  {
    //A list of pages to return after all the links have been evaluated
    List<PageReference> myFriendlyUrls = new List<PageReference>();
    for(PageReference mySalesforceUrl : mySalesforceUrls)
    {
      //Get the URL of the page
      String url = mySalesforceUrl.getUrl();
      //If this looks like a page that needs to be mapped, transform it
      if(url.startsWith(VISUALFORCE_PAGE))
      {
        //Extract the ID from the query parameter
        String id= url.substring(VISUALFORCE_PAGE.length(), url.length());
        Lead site_page2 = [select name from Lead where id =:id LIMIT 1];
        //Construct the new URL
        myFriendlyUrls.add(new PageReference(DIRECTORY + site_page2.name));
     } 
     else
     {
       myFriendlyUrls.add(mySalesforceUrl);
     }
  }
  //Return the full list of pages
  return myFriendlyUrls;
  }
}