• Yoganand Gadekar
  • SMARTIE
  • 632 Points
  • Member since 2012

  • Chatter
    Feed
  • 20
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 261
    Replies
Hai all
Can any one tell me how to use java script in visual force page by using static resources 
Hi,

We have the following, pls let me know how to solve it:
There are 3 record types for Case, say A,B and C.
If an User creates a Case record with record type A then restrict the User to View/Edit only Case records(his/others) of record type A only.
If an User creates a Case record with record type B then restrict the User to View/Edit only Case records(his/others) of record type B only.
How can it be done, pls let us know the solution as it is bit urgent.

Thanks a lot.
Hi All,

i am geting this error when i attch an image to master object (in file and attchments) and the detail object have records.i am also updating master object when a new detail record is added and approved. 
it seems that adding an image trigers the loop.

Error: Apex trigger trgOrphanImage caused an unexpected exception, contact your administrator: trgOrphanImage: execution of AfterInsert caused by: System.DmlException: Update failed. First exception on row 0 with id a0H2000000A5UtqEAF; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, trgAnnualProgressReportIns: execution of AfterUpdate caused by: System.ListException: Duplicate id in list: a0A2000000KkOr2EAF Class.AnnualReportUpdBiodata.updBiodata: line 96, column 1 Trigger.trgAnnualProgressReportIns: line 49, column 1: []: Trigger.trgOrphanImage: line 59, column 1

 
Create fieldset on Contact Object and render them based on the criteria in visualforce,Please give me best example??
I need help with a controller extension to retrieve and update parent records from a list view. We have a child object called Patient_Session__c that has a lookup to parent called Patient_c and want to use a visualforce page to update the parent records in mass edit mode from a list view of the child records.  Here's the extension I am using:

public with sharing class updatePatientInfo {
    public Patient_Session__c pgn;
    public Patient__c patient;

    public updatePatientInfo(ApexPages.StandardController controller) {
        this.pgn = (Patient_Session__c)controller.getRecord();
        this.patient = [SELECT Id,Name,Patient_Description__c,A_1__c,A_Frequency__c,B_1__c,B1_Frequency__c,B2_Frequency__c,C_1__c,C1_Frequency__c,C2_Frequency__c,D_1__c,D1_Frequency__c,D2_Frequency__c,X__c FROM Patient__c WHERE ID = :ApexPages.currentPage().getParameters().get('id')];
    }

    public PageReference saveRecord() {
        
    update patient;
    update pgn;  
        return null;
    }
 }

Here's the visualforcepage

<apex:page controller="updatePatientInfo" tabStyle="Patient_Session__c" sidebar="false">
<pbe:PageBlockTableEnhancerADV targetPbTableIds="details," paginate="true" defaultPageSize="100" pageSizeOptions="5,10,20,30,40,50,100" />
  <style type="text/css">
        .myClass { width: 300px; }
    </style>
<h1>Mass Edit Patients</h1>
<apex:form >
    <apex:pageblock >
    <apex:pagemessages />
       <apex:pageBlockButtons >        
        <apex:commandButton value="Quick Save" action="{!quicksave}"/>
        <apex:commandButton value="Save" action="{!save}"/>
        <apex:commandButton value="Cancel" action="{!cancel}"/>
    </apex:pageBlockButtons>
    <apex:pageBlockSection title="Details" columns="1">
    <apex:pageBlockTable value="{!selected}" var="pgn" id="details">
        <apex:column headervalue="First Name">
            <apex:inputField value="{!pgn.Patient__r.Patient_Description__c}"/>
        </apex:column>
            </apex:pageBlockTable>
            </apex:pageBlockSection>   
        </apex:pageBlock>
    </apex:form>        
</apex:page>

When I try to save the visualforce page I get this error
 "Error: Unknown constructor 'updatePatientInfo.updatePatientInfo()"

I am new to apex so any help would be greatly appreciated
I have created a page that displays opportunities across related accounts and I would like to allow users to create a new opportunity associated to one of those accounts directly from the page. Because I have a search function on the page as well, my form has multiple functions based on the action button used. If I simply added input fields for an Opportunity object, the field requirements (name, close date, etc.) would cause errors when searching. To resolve this I have created a custom Opportunity-like object (tOpp__c) without required fields and then I build a new Opportunity object in Apex. The problem I am running into is passing the selected option from a selectList into the controller so that I can populate fields on the Opportunity that require a lookup (Account, Owner, etc.) single-value input fields are passing data fine and the HTML output of the page appears to show the selected list populated correctly, but I get a null value in my debug logs for the selectList variable.

PAGE:
...
                 <apex:column headerValue="Account Name">
                     <apex:selectList size="1" value="{!tOpp.Account__c}">
                             <apex:selectOptions value="{!orgAcctOpts}"/>
                      </apex:selectList>
                 </apex:column>
...
                 <apex:column headerValue="">
                     <apex:commandButton value="Create" action="{!doCreateOpp}" rerender="all"/>
                 </apex:column>
...

CONTROLLER:

    public PageReference doCreateOpp() {
        System.Debug('Create Opportunity');
        for (tOpp__c tOpp : tOpps) {
            System.Debug('Starting Opportunity Insert: '+tOpp.Account__c);
            List<Account> accts = [select Id from Account where Name = :(tOpp.Account__c) limit 1];
            if (!accts.isEmpty()) {
                System.Debug('Account: '+accts.get(0));           
                Opportunity o = new Opportunity();
                o.Name = tOpp.Name;
                o.StageName = tOpp.StageName__c;
                o.CloseDate = System.today();
                o.Account = [select Id from Account where Name = :(tOpp.Account__c)];
                o.Owner = [select Id from User where Name = :(tOpp.Owner__c)];
                insert o;
            } else {
                System.Debug('Account Not Found: '+tOpp.Account__c);            
            }
        }
        return null;
    }

HTML:

...
       <td class=" dataCell  " id="summary_:form_:detail_:newopp_:0:j_id36" colspan="1">
            <select name="summary_:form_:detail_:newopp_:0:j_id37" size="1">    <option value="001m0000007HwqeAAC">Test1</option>
                <option value="001m0000007HwqyAAC">Test3</option>
                <option value="001m0000007HwrNAAS">Test5</option>
                <option value="001m0000007HwrDAAS">Test4</option>
                <option value="001m0000007HwqjAAC">Test2</option>
            </select></td>
...

DEBUG:

13:57:50.038 (38447582)|USER_DEBUG|[115]|DEBUG|Create Opportunities
13:57:50.038 (38455535)|SYSTEM_METHOD_EXIT|[115]|System.debug(ANY)
13:57:50.038 (38552803)|SYSTEM_METHOD_ENTRY|[116]|LIST<tOpp__c>.iterator()
13:57:50.038 (38745006)|SYSTEM_METHOD_EXIT|[116]|LIST<tOpp__c>.iterator()
13:57:50.038 (38777135)|SYSTEM_METHOD_ENTRY|[116]|system.ListIterator.hasNext()
13:57:50.038 (38792964)|SYSTEM_METHOD_EXIT|[116]|system.ListIterator.hasNext()
13:57:50.038 (38844991)|SYSTEM_METHOD_ENTRY|[117]|System.debug(ANY)
13:57:50.038 (38865250)|USER_DEBUG|[117]|DEBUG|tOpp.Account__c: null
13:57:50.038 (38872097)|SYSTEM_METHOD_EXIT|[117]|System.debug(ANY)
13:57:50.038 (38887525)|SYSTEM_METHOD_ENTRY|[118]|System.debug(ANY)
13:57:50.038 (38901300)|USER_DEBUG|[118]|DEBUG|Starting Opportunity Insert: null
13:57:50.038 (38907485)|SYSTEM_METHOD_EXIT|[118]|System.debug(ANY)
13:57:50.039 (39440025)|SOQL_EXECUTE_BEGIN|[119]|Aggregations:0|select Id from Account where Name = :tmpVar1 limit 1
13:57:50.042 (42866602)|SOQL_EXECUTE_END|[119]|Rows:0
13:57:50.042 (42983278)|SYSTEM_METHOD_ENTRY|[120]|LIST<Account>.isEmpty()
13:57:50.043 (43010277)|SYSTEM_METHOD_EXIT|[120]|LIST<Account>.isEmpty()
13:57:50.043 (43036387)|SYSTEM_METHOD_ENTRY|[131]|System.debug(ANY)
13:57:50.043 (43055532)|USER_DEBUG|[131]|DEBUG|Account Not Found:null
 
I have a Vfp with standard controller="Single_Topic__KAV" and controller extension="Feedbackctrl".
There is a custom checkbox field in Single_Topic__KAV, i want that field value in controller.

In VFP:
i can get the checkbox field by:
<apex:outputfield value="Single_Topic__KAV.Preview_Flag__c"/>

i need the field value to use in controller for:
If(Preview_Flag__c==false){---------------------------}
else{---------------------}
else{--------------------------------}
Do we know of any getting started or how to use material on SAQL ? Its Dev guide everything except how to use it :)

Hi all,

came up with a doubt,can i combine two different standard objects into single LIST

ie

List<contact> listname =  List<contact>;
List<campaignmember> listname =  List<campaignmember>;

i need to combine above two List into single one may be like (contact.campaignmember.date,contact.campaignmember.name)

i wrote a wrapper where i have access to those two list of data.now just need to combine  and return them as list ,is that possible ??.

please post possible ideas to do that.

 

Thanks
D Naveen Rahul.

Hi..
  Please Explain About Set And get Methods IN simple way..
   "Get" and "Set" Methods How thes work  ::
        1- Visual Force -To- Class(console).
        2-Console(Class) -To- VisualForce
Hi all, 

Okay so I'm pretty weak at using sub query and usually avoid this. So I will need a little help on this. 
 
List<Job__c> jobs = [SELECT ID, Contact__c, Project_site_contact_name__c, (SELECT ID, Contact__c FROM Job_Contacts__r) FROM Job__c WHERE ID in :updateContactIds];
	for (Job__c job : jobs)
	{		

		for(Contact con : jobs.job_contacts__r)
		{

                }
        {
So here's the little code snippet. I the 2nd for loop is giving me error saying "Initial term of field expression must be a concrete SObject: LIST&lt;Job__c&gt;"

If I understand correctly the error is saying Job.job_contact__c is not a list. How do I check through the sub query? 
Hi All,
   I have a requirement that when i calculate Net Amount=total=vat that after calculation this i have to fetch that formula field in my parent object so how can i fetch that field using Roll up Summary.
Thanks,
Sam
Hi frnds,

I have n  number of GrandParentAccount and their related Parent Accounts and their child accounts.

AccountName        parentAccountlookupfield    RecordType
GPACC - GP1          null                                     Test1
PACC - P1               GP1                                    Test1
CACC - C1               P1                                     anything

Based on Record type(if record type is same for both parent and grandparent) I need to change the child account's parent name as GranparentName.(For C1, i need to update parent account as GP1 instead of P1)
I need write schedulable apex for following prob..

I have contacts and Accounts standard object and one custom object attendance

Now for account-X there are two contact roles ->p and q-->

and Attendence is child object of contacts--

So for contact-->P -there are two attendence records wit status(data)-->1.payable and 2.Nonpayble


So for contact-->q there are two attendence records wit status(data)-->1.payable and 2.Nonpayble

Now I need write apex code to create a opportunity for this account X-
And I want add products to this opportunity

But I have already two products-Payable and Non payable with standard price

So for this opportunity i need to add this products accourding to the attendence records count of contact..

Ex:For X account opportunity---> there will be 4 produts(2-payable n 2-non payable)

Now I need apex code which will automaticaly create this opportunity and add products to it according to the contact attendence record.

and I want run this code once in a month..using scedule apex;

I think this very difficult , I am tring it from a weak...

Please help me to write this code..Even any reffence will also help me lot..
Hi.

I have a custom object (TargetX_SRMb__Application__c) It has a relationship to Contact defined in WSDL by:

  <complexType name="TargetX_SRMb__Application__c">
                <complexContent>
                    <extension base="ens:sObject">

...
                       <element name="TargetX_SRMb__Contact__c" nillable="true" minOccurs="0" type="tns:ID"/>
                        <element name="TargetX_SRMb__Contact__r" nillable="true" minOccurs="0" type="ens:Contact"/>

However, when I run SOQL test as:

 Contact contact = [SELECT  c.Id, c.lastName, (Select CreatedDate  FROM TargetX_SRMb__Contact__r) FROM Contact c]

I get error:

Error: Compile Error: Didn't understand relationship 'TargetX_SRMb__Contact__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name

I also tries adding a "s" as follows: Same error.

 Contact contact = [SELECT  c.Id, c.lastName, (Select CreatedDate  FROM TargetX_SRMb__Contacts__r) FROM Contact c]

 Is this not the correct syntax to query child records from a custom object?

Thanks in advance,

Jon
Hi,

I have defined Apex triggers on after insert which will fire the email on per case basis. Issue is same email is firing twice. Could any one help to get it solve..

trigger sendEmail on Case (after insert,after update) {
    Public static Boolean InitialEmail =false;
  
     for(Case c:trigger.new) {
       
        system.debug('outside'+c.Send_Email_to_Contact__c);
       
        if ((trigger.isInsert || (trigger.oldMap.get(c.Id).Send_Email_to_Contact__c != c.Send_Email_to_Contact__c)) && (c.Send_Email_to_Contact__c && !c.Do_not_Send_Email__c  && c.Email_of_Complainant__c!=null && c.Status!='Completed')) {
               
                system.debug('??????'+c.Send_Email_to_Contact__c);
              
                    sendEmailMessage(c.id,c.ownerId,c.Internal_Comments__c,c.Email_of_Complainant__c,c.Site_Details__c,c.CaseNumber,c.Case_Customer_Reference__c );
        }
       
}       
       
       
Hello all,

I'm starting to develop for Sales Force, so everything here is kind of new to me.

I've already followed the following developer workbooks:
- Force.Com Workbook
- Force.com Integration Workbook

I now need to start researching on how to implement the specific needs of my client. The problem is I do not know where to start and need some guidance on the first steps.
The two features I need to implement are:

1. Textbox in the top bar
I need to place a new textbox on the top bar that is always visible, somewhere to the right of the existing Search box.
This textbox will fire requests to an external application and redirect to a custom made results page in Sales force.

2. User as bot in chat
I would like to create a new user, let's call him "Adam". Whenever another user "talks" with "Adam" I would like to fire a request to an external application and return the result as Adam's response.
If this is not possible, a workaround would be to create a new control that would sit next to the Chat in the bottom right corner of the page. This control would be called "Adam" and would be similar to the existing Chat but would request information from our external application.

Any suggestions on how to implement these features? Any documents, forum posts, or bits of information that can get me started would be appreciated.

Thanks in advance for your help.

Kindly
Eduardo Poças
hi, how can i calculate next working day excluding public holiday configured in my saleforce org & weekend using formula field?

can anyone share me the formula?
In Leads Page, I want to have  a Sales Score Text field (formula field ), which needs to be updated by first checking the campaign field is empty or not and has to update the Sales Score field based on other Campaign Score field (Number field).

Is this is possible with Formula fields, if so how ...

Please clarrify..
Hi all, 

I have created one visualforce page. In that There is a picklist component with many values inside.
Now whenever i run that visualforce page on google chrome(Version 32.0.1700.76 m) at that time i
can't able to pull down the scroll bar using mouse first click. can you please help me over this?