• ABHIKSARKAR
  • NEWBIE
  • 50 Points
  • Member since 2009

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 17
    Replies

Hello,

 

I have a validation rule that checks to see if a region (custom field) has been specified or not for any given opportunity.

 

The validation rule generally works fine, but when I try to make an opportunity "close/lost" then it tells me that the record cannot be saved because the region has not been specified. Even if the region field is in fact populated the error message persists.

 

I have decided to deactivate the validation rule in order to update the opportunity but even with the validation rule deactivated the message persists and I am unable to make my opportunities "closed/lost". I can make then anything else as long as they are still read in the pipeline.

 

Has anyone ever come across such a bazaar situation?

Can you create a trigger on the Partner or Opportunity Partner Object?

 

 

 

Want to calculate the age of historical case data by subtracting the time when the case was in pending status. 

I am able to track the age for any new cases created by tracking two dates. 
1.) Date on which the Case went into Pending stage. 
2.) Date on which the Case went out of Pending stage. 

However, I am not able to update the fields for existing Case data. 

PS: We do have history tracking enabled for Status field. 

Is there a way to fetch the above dates from Case History object . 
Hi ,
I want to generate a list of all the components within a org which has a code coverage below 75% .
Is there a easier way to do this apart from manually going in to each class/trigger to check for the code coverage.
Any suggestions would be much appreaciated.

Thanks
 

Hi ,

 

I have run into an issue with comsuming the Partner WSDL & its critical to get this resolved because of my project timelines. 

 

We have developed a Web Service in our Salesforce.com instance & exposed it to an external system . For logging into the Salesforce.com instance we have shared the partner wsdl to the external team. Now while consuming the partner wsdl at their end , they are facing this issue. 

 

Wondering if anyone got through this issue . Any help to get this resolved would be highly appreciated. 

 

Please see the error below : 

 

Errors occurred during wsimport.

 

  warning: src-resolve: Cannot resolve the name 'tns:ID' to a(n) 'type definition' component.

 

  line 0 of file:/C:/Workspace/Merchant%20Site%20Int'l%20-%20Pharse%204/NGMSShr/src/com/americanexpress/services/ws/generated/client/merchantforce/patnerservice/Partner.wsdl#types?schema1

 

error: A class/interface with the same name "com.americanexpress.services.ws.generated.client.merchantforce.patnerservice.DescribeLayout" is already in use. Use a class customization to resolve this conflict.

  line 0 of file:/C:/Workspace/Merchant%20Site%20Int'l%20-%20Pharse%204/NGMSShr/src/com/americanexpress/services/ws/generated/client/merchantforce/patnerservice/Partner.wsdl#types?schema2

 

error: (Relevant to above error) another "DescribeLayout" is generated from here.

  line 0 of file:/C:/Workspace/Merchant%20Site%20Int'l%20-%20Pharse%204/NGMSShr/src/com/americanexpress/services/ws/generated/client/merchantforce/patnerservice/Partner.wsdl#types?schema2

 

error: Two declarations cause a collision in the ObjectFactory class.

  line 0 of file:/C:/Workspace/Merchant%20Site%20Int'l%20-%20Pharse%204/NGMSShr/src/com/americanexpress/services/ws/generated/client/merchantforce/patnerservice/Partner.wsdl#types?schema2

 

error: (Related to above error) This is the other declaration.  

  line 0 of file:/C:/Workspace/Merchant%20Site%20Int'l%20-%20Pharse%204/NGMSShr/src/com/americanexpress/services/ws/generated/client/merchantforce/patnerservice/Partner.wsdl#types?schema2

 

error: com.sun.istack.SAXParseException2: (Related to above error) This is the other declaration.  

 

 

 

  com.sun.istack.SAXParseException2: (Related to above error) This is the other declaration.   

 

 

 

Can we add a custom button to a standard calendar view?

Please suggest .  

I have controler extention in which I use a query to populate a picklist:

public class passengerExtention {

    
    private final Individuele_Boeking__c boeking;
    public string selectedArea {get; set;}

    public passengerExtention(ApexPages.StandardController controller) {

        this.boeking = (Individuele_Boeking__c) controller.getRecord();
    }
    
    //Picklist Area
    public list<selectoption> getAreaOptions(){
        
        
        //Verzamel waarden voor picklist
        SelectOption firstOption = new SelectOption('', ' - Choose Area - ');
        
        list<selectoption> Areas= new list<selectoption>();        
        list<Ships_location__c> selectedArea= [SELECT Area__c
                                               FROM Ships_location__c
                                               ORDER BY Area__c ];
                                               
        //Vul picklist                                       
        Areas.add(firstOption);
        
        for(Ships_location__c sl:selectedArea){
            Areas.add(new selectoption(sl.Area__c,sl.Area__c));
        }
        return Areas;     
    }

This works nicely, but it gives a lot of double values in the picklist...
So I tried to transform it with a GROUP BY query but I cannot get it work:

the result sofar is:

public class passengerExtention {

    
    private final Individuele_Boeking__c boeking;
    public string selectedArea {get; set;}

    public passengerExtention(ApexPages.StandardController controller) {

        this.boeking = (Individuele_Boeking__c) controller.getRecord();
    }
    
    //Picklist Area
    public list<selectoption> getAreaOptions(){
        
        
        //Verzamel waarden voor picklist
        SelectOption firstOption = new SelectOption('', ' - Choose Area - ');
        
        list<selectoption> Areas= new list<selectoption>();        
        list<AggregateResult> selectedArea = [SELECT Area__c, COUNT(id)
                                               FROM Ships_location__c
                                               GROUP BY Area__c
                                               ORDER BY Area__c ];
                                               
        //Vul picklist                                       
        Areas.add(firstOption);
        
        for(AggregateResult sl:selectedArea){
            Areas.add(new selectoption(sl.Area__c,sl.Area__c));
        }
        return Areas;     
    }
   
The error is invalid field Area__c for sObject AggregateResult...

I would appreciat any suggestion.

Thanks,

Robert
I am looking for some help on a trigger to update a field.  I have 3 custom objects (job, Employee, and Employee form). the job is the master to the employee and the employee is the master to the employee form.  I have a number field called hats on the job object and when an employee form is created i want to use the quantity field to update the hat field.

So far i have the following but i am getting the error "Initial term of field of expression must be a concrete object".


trigger updateHats on Employee_Forms__c (before insert) {
   set<id> jobids=new set<id>();  
   map<id,jobs__c> jobsmap=new map<id,jobs__c>([select id, hats__C from jobs__c where id=:jobids]);
   //List<Jobs__C>Jobs=new list<jobs__c>();
    For(employee_forms__C b:Trigger.new)
        if(b.Uniform_Type__C=='Hat')
    {
        jobsmap.hats__C= jobsmap.hats__C - b.Quantity__C;
    }
        }


 
 
 
 
 
on the employee object I have

label: Job      API Name: Job__C  Data Type: Master-Detail(Job)

and the employee_Forms__C i have

Label: Employee    API Name:  Employee__C  Data Type:  Master-Detail(Employee)


I think its because the job and the employee form object are not directly related but i am not sure and if i was sure i am not sure how to go about fixing it.  

Any help i would appreciate 
 
Want to calculate the age of historical case data by subtracting the time when the case was in pending status. 

I am able to track the age for any new cases created by tracking two dates. 
1.) Date on which the Case went into Pending stage. 
2.) Date on which the Case went out of Pending stage. 

However, I am not able to update the fields for existing Case data. 

PS: We do have history tracking enabled for Status field. 

Is there a way to fetch the above dates from Case History object . 
Hi ,
I want to generate a list of all the components within a org which has a code coverage below 75% .
Is there a easier way to do this apart from manually going in to each class/trigger to check for the code coverage.
Any suggestions would be much appreaciated.

Thanks
 

Hi,

 

How to check the Lead owner(Ownerid) is active or inactive in workflows. please suggest on this.

 

Thanks in advance

 

Krish

I have a case where i need to select Approvers Dynamically where every one has to Approve the record (Unanimous  )

should not be in Approval Levels .. 

I made a Queue adding Group members selected but this is taken 1 unit for Approval 

 

How do i acheive this Use case.

 

How to add users to Approvers in Approval process ...

Hello everyone,

 

I have overriden standard opportunity Edit feature. In order to provide inline edit i have to also override the view. The VF page used for the view is very simple and is as below. But now there is a problem. Another VF page which was embeded earlier as part of the opportunity page layout now comes as blank with this overriden view. I guess it is because of the detail tag - how can now i adjust that VF page with this functionality?

 

<apex:page standardcontroller="Opportunity">
    <apex:form >
        <apex:detail subject="{!opportunity.Id}" relatedlist="true" inlineedit="true"/>    </apex:form>
</apex:page>

Hello,

 

I have a validation rule that checks to see if a region (custom field) has been specified or not for any given opportunity.

 

The validation rule generally works fine, but when I try to make an opportunity "close/lost" then it tells me that the record cannot be saved because the region has not been specified. Even if the region field is in fact populated the error message persists.

 

I have decided to deactivate the validation rule in order to update the opportunity but even with the validation rule deactivated the message persists and I am unable to make my opportunities "closed/lost". I can make then anything else as long as they are still read in the pipeline.

 

Has anyone ever come across such a bazaar situation?

Can you create a trigger on the Partner or Opportunity Partner Object?

 

 

 

I am trying to build a custom dynamic lookup component. I have put this component in a form, choosing a record from object record list (from lookup) and lastly calling a method from commandButton to check record Id and name properly selected or not.

 

This is working fine when I am using it alone in a VF Page form. Getting the id and name what I am selecting in the method's system.debug(). But when I am trying this component multiple times in a PageBlockTable, it makes some problem. No issue on selecting record on each of this lookup. But when I am clicking the button to check all the lookups value in the controller's method, I found the method is not being called. In debug log, I couldn't even found the method name too.

 

I am providing my component, component controller, lookup page, component calling page and its cotroller.

 

// ==========================component ===============================================

<apex:component controller="mycompController">
    <script>
        function windowOpener(windowHeight, windowWidth, windowName, windowUri, lookupName, lookupId)
        {
            try{
                var valueNm = document.getElementById(lookupName).value;
                var valueId = document.getElementById(lookupId).value;
                var centerWidth = (window.screen.width - windowWidth) / 2;
                var centerHeight = (window.screen.height - windowHeight) / 2;
                var windowUri = windowUri + '&providedValue=' + valueNm.ReplaceAll(" ", "_").ReplaceAll("&nbsp;", "_");
                windowUri = windowUri + '&providedId=' + valueId;
                
                newWindow = window.open(windowUri, windowName, 'scrollbars=yes,width=' + windowWidth +
                    ',height=' + windowHeight +
                    ',left=' + centerWidth +
                    ',top=' + centerHeight);
            
                newWindow.focus();
                return newWindow.name;
            }catch(e){
                alert(e);
            }    
        }
        
        String.prototype.ReplaceAll = function(stringToFind, stringToReplace)
        {
            var temp = this;
            var index = temp.indexOf(stringToFind);
            while(index != -1)
            {
                temp = temp.replace(stringToFind,stringToReplace);
                index = temp.indexOf(stringToFind);
            }
            return temp;
        }
    </script>
    
    <apex:attribute name="data" description="This is the data value for the component." type="String" />
    <apex:attribute name="type" description="This is the type for the component." type="String" required="true" default=" " />
    <apex:attribute name="value" description="This is the value variable for the component." type="String" required="true" />
    <apex:attribute name="valueId" description="This is the Id value for the Lookup component." type="String" />
    <apex:attribute name="label" description="This is the label of the component." type="String" />
    <apex:attribute name="required" description="This is the name of the component." type="Boolean" />
    <apex:attribute name="fields" description="This is used for fields to be queried in Lookup" type="String"/>
    <apex:attribute name="condition" description="This is used only condition required in Lookup" type="String"/>
    
    <apex:outputPanel rendered="{!(type == 'Lookup')}">
        <apex:inputText label="{!label}" value="{!value}" required="{!required}" id="lookupName"/>
        <apex:inputHidden id="lookupId" value="{!valueId}"/>
        <a title="Search" onclick="windowOpener(350, 650, 'Search', '/apex/LookupPage?Name={!$Component.lookupName}&Id={!$Component.lookupId}&ObjectAPI={!data}&ShowFields={!fields}&Condition={!condition}', '{!$Component.lookupName}', '{!$Component.lookupId}');">
            <img class="lookupIcon" onmouseover="this.className = 'lookupIconOn';this.className = 'lookupIconOn';this.style.cursor = 'pointer';" onmouseout="this.className = 'lookupIcon';this.className = 'lookupIcon';" onfocus="this.className = 'lookupIconOn';" onblur="this.className = 'lookupIcon';" alt="Search" src="/s.gif"/>                        
        </a>
    </apex:outputPanel>
    
</apex:component>

 

 

// ==========================component controller =======================================

public class mycompController
{
    public String searchText {get; set;}
    public List<SObject> searchList {get; set;}
    public Boolean showTable {get; set;}
    public String table {get; set;}
    public Map<String, String> searchNameIdMap = new Map<String, String>();
    
    public mycompController()
    {
        searchText = '';
        if(ApexPages.currentPage().getParameters().get('providedValue') != null && ApexPages.currentPage().getParameters().get('providedValue').trim() != '')
            searchText = ApexPages.currentPage().getParameters().get('providedValue').trim().replaceAll('_', ' ');
        if(ApexPages.currentPage().getParameters().get('providedId') != null && ApexPages.currentPage().getParameters().get('providedId').trim() != '')
            searchNameIdMap.put(searchText, ApexPages.currentPage().getParameters().get('providedId').trim());
    }
    
    public void search()
    {
        System.debug('========>>'+ApexPages.currentPage().getParameters().get('ObjectAPI'));
        String textName = ApexPages.currentPage().getParameters().get('Name');
        String textId = ApexPages.currentPage().getParameters().get('Id');
        String ObjectAPI = ApexPages.currentPage().getParameters().get('ObjectAPI');
        String ShowFields = ApexPages.currentPage().getParameters().get('ShowFields');
        String Condition = ApexPages.currentPage().getParameters().get('Condition');
        
        String query = '';
        table = '';
        String queryFields = '';
        if(ShowFields != null && ShowFields.trim() != '')
        {
            String tempQueryFields = '';
            System.debug('----cond> '+tempQueryFields.toLowerCase().contains('id'));
            if(!ShowFields.trim().toLowerCase().contains('id'))
            {
                tempQueryFields += 'Id, ';
            }
            if(!ShowFields.trim().toLowerCase().contains('name'))
            {
                tempQueryFields += 'Name, ';
            }
            tempQueryFields += ShowFields.trim();
            queryFields = tempQueryFields;
        }
        else
            queryFields = 'Id, Name';
        query += 'select ' + queryFields + ' from ' + ObjectAPI;
        if(Condition != null && Condition.trim() != '')
        {
            query += ' where ' + Condition;    //.replaceAll(':', '=');
        }
        
        if(searchText != null && searchText.trim() != '')
        {
            if(query.contains(' where '))
                query += ' and Name like \'%'+searchText+'%\'';
            else
                query += ' where Name like \'%'+searchText+'%\'';
            
            if(searchNameIdMap.get(searchText) != null)
                query += ' and Id = \'' + searchNameIdMap.get(searchText) + '\'';
        }
        
        query += ' order by Name limit 1000';
        System.debug('------query> '+query);
        
        Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
        Map<String, Schema.SObjectField> M=new Map<String, Schema.SObjectField>();
        M = gd.get(ObjectAPI).getDescribe().fields.getMap();
        
        List<String> tableHeaderList = new List<String>();
        List<String> tableDataList = new List<String>();
        
        for(String val : queryFields.trim().split(','))
        {
            tableHeaderList.add(val.trim().replace('__c', '').replace('_', ' '));
            tableDataList.add(val.trim());
        }
        
        table += '<table border="0" align="center" width="90%" id="lookupTable" class="tablesorter"><thead><tr>';
        for(Integer i = 0; i < tableHeaderList.size(); i ++)
        {
            if(tableHeaderList[i].trim().toLowerCase() == 'id')
                continue;
            table += '<th>'+tableHeaderList[i]+'</th>';
        }
        table+='</tr></thead><tbody>';
        
        searchList = database.query( query );
        
        for(SObject u : searchList)
        {
            table += '<tr>';
            Integer j = 0;
            String lineId = '';
            for(integer i = 0; i < tableDataList.size(); i ++)
            {    
                if(i == 0 && tableDataList[i].trim().toLowerCase() == 'id')
                {
                    lineId = String.valueOf(u.get(M.get(tableDataList[i])));
                    continue;
                }
                String val = '';
                if(i == 1)
                    val = textName+':::'+textId+':::'+(u.get(M.get(tableDataList[i])) != null ? String.valueOf(u.get(M.get(tableDataList[i]))).replaceAll(' ', ' ').replaceAll('\'', '') : 'N/A')+':::'+lineId+':'+String.valueOf(u.get(M.get(tableDataList[i]))).replaceAll(' ', '_').replaceAll('\'', '');
                if(j ++ == 0)
                {
                    table += '<td>' +
                    '<a href="#" onclick=valueSetterCloser("'+val+'")>' +
                        '<span>' + String.valueOf(u.get(M.get(tableDataList[i]))).replaceAll('\'', '') + '</span>' +
                    '</a></td>';
                }
                else
                    table += '<td>' + (u.get(M.get(tableDataList[i])) != null ? String.valueOf(u.get(M.get(tableDataList[i]))).replaceAll('\'', '') : 'N/A') + '</td>';
            }
            table+='</tr>';    
        }
        table+='</tbody></table>';
        System.debug('------table> '+table);
    }
}

 

 

//============================= calling page ==================================

<apex:page controller="ABCClass">
    
    <apex:actionStatus id="wait">
        <apex:facet name="start">Processing...</apex:facet>
    </apex:actionStatus>
    
    <apex:form >
        <apex:pageBlock id="blk">
            <apex:pageBlockTable value="{!tableContent}" var="curVal">
                <apex:column >
                    <c:mycomp data="Contact" type="Lookup" value="{!curVal.val}" valueId="{!curVal.valId}" fields="Email, Phone" required="true" label="{!curVal.label}"/>                    
                </apex:column>
            </apex:pageBlockTable>           

<!-- working fine -->
            <!--<c:mycompdata="Contact" type="Lookup" value="{!curVal.val}" valueId="{!curVal.valId}" fields="Email, Phone" required="true" label="{!curVal.label}"/>-->
                  
        </apex:pageBlock>
        
        <apex:commandButton value="Click" action="{!callM}" reRender="blk" status="wait" />
    </apex:form>
    
</apex:page>

 

//=============================calling page controller ==========================

public class ABCClass
{
    public String val {get; set;}
    public String valId {get; set;}
    public String val1 {get; set;}
    public String valId1 {get; set;}
    public Boolean chkVal {get; set;}
    public String txtVal {get; set;}
    public String txtAreaVal {get; set;}
    public String pickVal {get; set;}
    public List<MyClass> tableContent {get; set;}
    
    public class MyClass
    {
        public String val {get; set;}
        public String valId {get; set;}
        public String label {get; set;}
        
        public MyClass(String val, String valId, String label)
        {
            this.val = val;
            this.valId = valId;
            this.label = label;
        }
    }
    
    public ABCClass()
    {
        val = '';
        valId = '';
        val1 = '';
        valId1 = '';
        chkVal = true;
        txtVal = 'suman';
        txtAreaVal = '';
        pickVal = 'b';
        tableContent = new List<MyClass>();
        
        for(Integer i = 1; i <= 5; i ++)
        {
            tableContent.add(new MyClass('', '', 'My Lookup - '+i));
        }
    }
    
    public void callM()
    {
        System.debug('------->>Lookup> '+val+', '+valId);
        System.debug('------->>Lookup1> '+val1+', '+valId1);
        System.debug('------->>Checkbox> '+chkVal);
        System.debug('------->>Textbox> '+txtVal);
        System.debug('------->>Textarea> '+txtAreaVal);
        System.debug('------->>Picklist> '+pickVal);
        
        for(MyClass mc : tableContent)
        {
            System.debug('------->>'+mc.label+'> '+mc.val+', '+mc.valId);
        }
        
    }
}

 

 

//============================= lookup page ==================================

<apex:page controller="DynamicComponentController" showHeader="false" sidebar="false" action="{!search}">
    <apex:stylesheet value="{!URLFOR($Resource.TableSorter, '/TableSorter/themes/blue/style.css')}"  />
    <apex:includeScript value="{!URLFOR($Resource.TableSorter, '/TableSorter/js/jquery.js')}" />
    <apex:includeScript value="{!URLFOR($Resource.TableSorter, '/TableSorter/js/jquery.tablesorter.js')}"  />
    <style>
        #wrapper {margin: 0 auto;width:1200px; margin-left:300px; }
    </style>
    <script>
        function valueSetterCloser(details)
        {
            //alert(details);
            var arr = details.split(":::")
            lookupName = arr[0]
            lookupId = arr[1]
            dataName = arr[2]
            dataId = arr[3]
            var arr1 = dataId.split(":")
            //alert(dataName+' => '+arr1[1]+', '+arr1[1].ReplaceAll("_", " "));
            try{
                top.window.opener.document.getElementById(lookupName).value=arr1[1].ReplaceAll("_", " ");    //dataName; 
                top.window.opener.document.getElementById(lookupId).value=arr1[0];    //dataId;
                top.window.opener.document.getElementById(lookupName).focus(); 
                top.window.close();
            }
            catch(e){alert(e);}
        }
        function abc()
        {
            document.getElementById('searchResultSection').innerHTML='{!table}';
            $("#lookupTable").tablesorter({debug: true});
        } 
        window.onload=abc;
        
        String.prototype.ReplaceAll = function(stringToFind,stringToReplace)
        {
            var temp = this;
            var index = temp.indexOf(stringToFind);
            while(index != -1)
            {
                temp = temp.replace(stringToFind,stringToReplace);
                index = temp.indexOf(stringToFind);
            }
            return temp;
        }
    </script>
    <apex:sectionHeader title="Record Selector"/>
    <apex:pageBlock >
        <apex:form >
            <apex:pageBlockSection columns="1">
                <apex:pageBlockSectionItem >
                    <apex:outputLabel >Search For:&nbsp;</apex:outputLabel>
                    <apex:outputPanel >
                        <apex:inputText value="{!searchText}"/>
                        <apex:commandButton value="Go" action="{!search}"/>
                    </apex:outputPanel>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
            
            <div id="searchResultSection">
            
            </div>
        </apex:form>
    </apex:pageBlock>
</apex:page>

If Apex runs in system mode, then why does getContentasPDF() not work if the user does not have access to the VF page.

 

I want to control when a page is generated via code. Because of the above, In order to do so I have to give the users access to the VF page and thus they can generate it anytime as long as they know the pagename and how to construct the url.....

 

 

I have a field on my page layout that is utilized as a file name.

Another field that is a formula to concatenate "file://N:/Folder1/"&{!File_Name__c}&".pdf"
I tested this with the formula Hyperlink and works perfect from the details page.

Within my Visualforce page I have a table for Contacts.

 

<apex:outputLink value="{!c.URL}">View File</apex:outputLink>
When I test this it does not open a page or do anything. 

 

Everything has been copied into a sandbox

When I test the same code above the link works.

Is there any differences between a Sandbox server making a call to a local file on my computer as apposed to from Production?

 

I am seeing different behaviors for my Visualforce page depending on whether the user who runs it has development enabled or not.

 

I have two users that have the same role and profile but one has development mode turned on and the other does not.

 

I have a layout for a custom object that includes a Visualforce page as part of the standard layout.  This Visualforce page has an Action button.  The action button performs some logic and then returns a PageReference of the original page with redirect set to true so that the whole page refreshes.

 

When I click the action button as the user who has development enabled, everything works as I expect it to.  When I click the action button as the user who does not have development enabled, the refreshed page is display in the area that used to occupied by the Visualforce page.  The entire Salesforce page is now displayed inside the original page.

 

Has anyone else seen anything like this?  I have read some posts about the Visualforce page and the main page running in different domains and that makes sense - except in this case, if I have development enabled everything works.

 

I also see this same behavior (Salesforce page displayed within the Salesforce page) if I have an unhandled exception in the controller extension for my Visualforce page.  In this case, it doesn't matter whether I am running as a user with development privileges or not.