• The Knight
  • NEWBIE
  • 35 Points
  • Member since 2008

  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 52
    Questions
  • 44
    Replies
working fine before. But when i migrated to the latest AJAX API version it is killing me. I marked the code red here is the error
This is the error i am getting in the debug log window.
 
Using bookmarklet version of shell: commands will run in opener's context.
sf:INVALID_SESSION_ID
INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session
 
Plz see the code below
I am using this ApI
 
<script src="/soap/ajax/13.0/connection.js" type="text/javascript"></script>
 
window.setTimeout(";", 1000);
var date = new Date();
var task= new sforce.SObject("Task");
task.set("Subject", reason);
task.set("Type", "Other");
task.set("LegacyID__c", "SB");
task.set("WhoId", "{!Contact.Id}");
task.set("WhatId", "{!Account.Id}");
task.set("Status", "Completed");
task.set("IsClosed", "true");
task.set("ActivityDate", date);
task.set("Description", notes);

var saveResultTask = sforce.connection.create([task]);
for (var i=0; i<saveResultTask .length; i++)
{
if (saveResultTask [i].success == true)
{
}
else
{
alert("An error has occurred: " + saveResultTask [i].errors[0].message);
}
}
changeOwner();
parent.frames.location.replace("/servlet/servlet.FileDownload?file=0153000000042gA");
}
catch(error)

sforce.debug.log(error.faultcode);
sforce.debug.log(error.faultstring);
document.getElementById("divSave").style.visibility='hidden'
document.getElementById("Submit1").disabled = false;
return false;
}
  • July 17, 2008
  • Like
  • 0

In Apex Language reference it is mentioned that there is a single argument constructor for Dom.Document object  accepting String, it throws error saying that constructor does not exist.

 

Code from the Apex Language Reference:

String xml = httpResponse.getBody();
Dom.Document domDoc = new Dom.Document(xml);

 

Error I am getting:

 

Error: Compile Error: Constructor not defined: [dom.Document].<Constructor>(String) at line 51 column 34

 

Did anyone see this constructor working?

 

Thanks,

Joseph

 

 

We have a requirement to store image as part of a record.Is there a way?

 

Currently  I am thinking of storing document Id in a text field(since there is no way of having lookup of Document) in the record and when the page loads the image from the documents will be fetched and displayed.

 

 

 

Org1:

    System Administrator:

     1. Few tabs were with "Default On" and

          Few tabs were with "Tab Hidden" 

      2. Included all the tabs in the package and uploaded the package.

 

Installed the package in Org2.

 While installing the package the System Administrator profile of Org2 is mapped with System Administrator of Org1

 

In Org2:

   When opened the System Administrator profile I can see all the tabs has the "Default On" option selected, which should not be the case and should inherit the permissions from the profiles of the Org1.

 

Please let me know why this is happening.

Any help would be appreciated.

 

Regards,

Joseph

In Apex class can we differentiate a custom profile with standard profile.

We have requirement to show the list of custom profiles only.

Please let me know how this can be achieved?

 

 

I am trying to fetch the default values for the fields. I am doing

 

Schema.DescribeSObjectResult DSR = myObj__c.getSObjectType().getDescribe(); 
    			Map<String, Schema.SObjectField> CRFieldsMaps = DSR.fields.getMap();
	            for(String keyMap:CRFieldsMaps.keySet()){
	            	Schema.DescribeFieldResult descField = CRFieldsMaps.get(keyMap).getDescribe();

descField.getDefaultValue();

}

descField.getDefaultValue() returns null.

I am having date/time field with NOW() as default value.

 

If I use defaultValueFormula() this returns the formula not the value.

 

 

 

When the session expires and the visualforce page tries to reload.  I am getting the following message on visualforce page.

"Session Invalid The session in this window has become invalid.
Did you login again from another window?
Please reload the page in this window to refresh the session."

 

I did not login to anyother org.

 

I don't want to show this error on visualforce page. How can this be avioded?

If this cannot be avoided. I want to redirect the user to the login page. Can this be achieved?

 

Any help would be appreciated.

Thanks in Advance.

 

 

 

How can I check from which object the junction object is inheriting the sharing model.It simply shows controlled by parent. But from which parent.I know that the sharing model will be inherited from the first master.

 

Scenario:

I have junction object with two masters. One master "A" has public read only sharing and the other "B" has public read/write.

I need to link records of  "A" and "B". But I dont have access to A's records and hence the junction record insertion is getting failed saying "insufficient access to cross reference entity Id".

 

How to retrieve a list of users who has the create permission on a particular object?

 

We can find out whether the current logged in user has permission on specific object.

<objToken>.getDescribe().isCreateable().

 

 

Please let me know how this can be achieved.

 

Thanks in Advance.

I am having one datetime field. I want to use it in where clause of soql. Can I mention only date value for that field and get all the values on that particular date?

 

Eg. DueDate- Datetime field.

      select ... from xyz where Duedate__c =only date no time to be mentioned

 

If there is any work around please let me know.

 

Any help would be appreciated.

Thanks in advance.

Why there is no provision for deleting the users in the org? We can only make the user as inactive.

I want to remove all the custom labels in my org. Can this be done using destructivechanges.xml? Or is there a way to do that?

 

 Any help will be appreciated.

 

 

I have created two Dev orgs. In one org(without any package) I am getting mails when ever an exception occurs in Apex. The second org contains managed package. For this I am not able to receive exception mail. I have checked the Send Apex Warning Emails checkbox. but still not getting the mails. The emailId is correct :) .

We are using ajax toolkit in visualforce page(apex.js and connection.js). Kindly let me know whether this will also be deprecated along with the s-controls or not.

 

Regards

Joseph

We have a requirement to display notes&Attachments of a particular record in Ext Js grid. How can we get the notes & Attachments of a particular record through soql and display it as a comma seperated hyper links in a table.

 

    Record              Notes&Attachments

     rec1                     n1,a1

     rec2                     n2,a2

 

Like apex:detail, apex:listViews, is there a way to open a standard edit page layout in the visualforce page. we are planning to use satndar layouts without the standard header and with little customization. Any help would be appreciated.

 

Thanks in advance

Joseph

Is there a way to create a user using metadata API?

We have a requirement to take print of part of the page. Right now I am using Yahoo UI(Modal Dialog) for the

popup and using CSS as shown below

  @media print{.....}.

 

 This prints the specified part of the page but along with salesforce header and footer (CustomTabs, Logo, Links 

specified in the footer ). How can we avoid these parts in the printout.

 

Making showHeader="false" is not an option. 

 

Any help would be appreciated

Joseph

 

 

Governor limit is per request  or session or context?

Getting Too many soql 101 exception. Once reached we are not able to use the same querystring parameter values any more even after relogin.

 

Design:  

 We designed our application in a single page.We are using a "tabPanel" with three tabs and in each tab we have a PanelBar and in each panelbar we have around five "PanelBarItems". In each PanelBarItem we have one Apex:component associated with their own controller. Totally we have around 40 selectlist components on the page which gets populated when the page is loaded.

 

Problem: The scenario is the user searches for the Person by giving the name in the textbox the list of user along with other detais will be displayed in the datatable in a popup with hyperlink to select the particular Person. Once the particular Person is selected the page gets reloaded and the personId is appended to the URL and his related data is populated onto the main page. Now when we particular  rerender the outputpanel of the page the total soql queries in the page's getter methods are executed and hitting the SOQL limit.

  Once we relogin and give the same URL with the personId directly still it is showing Too many soql queries 101. We cannot perform any operation for that person even if we relogin?

 

   How to solve this issue? We are trying to minimise the queries as far as possible. But the queries for a particular URl is getting counted and once it reaches 100. we are not able to proceed further with that URL anymore even after relogin.

 

Any help would be appreciated

Joseph

   

In a VF page I have two  <apex:component> A and B. This components are not related with each other each having their own controllers. How can I pass data between these two components? The same way I need to pass data from these components to the main page.which is again having a different controller. 

  

  I have seen the example of dependency Injection mechanism. But it helps in passing values from page to

components or from parent to child components. But I need to pass values between two components with no relation.

 

Any help would be appreciated

Joseph

 I am using

ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,'Please Enter atleast four Characters'));

 to display error message. The error message is getting displayed properly based on the condition. 

  But the following warning message is also getting dislayed some times.

The element type "td" should be terminated by the matching end-tag "</td>". at line 21

 

This is not required. How to avoid this warning message on the screen? 

Hi,

   When I try to assign a new role to a user who's role is already defined. The former role is divested for the user. Can't we assign multiple role to the same user at a time? Ex: A User can have roles CEO and CFO or some other role which is in some other hierarchy.

Hi Guys,

 

I have situtaion like this when a link is clicked on external website it has to populate our visualforce page on that web page.

***The website is not developed in salesforce.

 

Can anybody help me....

 

Thanks,

Bujji

  • September 12, 2012
  • Like
  • 0

I've created a VisualForce page that I have embedded on the Account Page Layout. It serves as a custom Opportunity Related List, with the ability to Edit and Delete Opportunities. Whenever I delete Opportunities, my JavaScript action function is set up so that the VisualForce form refreshes and the deleted record is no longer visible. However, how can I refresh the Account Page in which the VisualForce is embedded. 

 

From looking at code, it seems it has to potentially do with the reRender attribute, but I'm not sure if the reRender attribute only affects the embedded VisualForce page. Here is the code I have for my embedded VisualForce.

<apex:page standardController="Account" extensions="opportunityRelatedList,deleteOpportunityRelatedListRecords">
<apex:form id="form">
    <apex:pageBlock title="Large Opportunities">  
        <apex:pageBlockTable value="{!FilteredOpportunities}" var="opp">        
            <apex:column >
                <apex:outputLink value="/{!opp.id}/e?retURL=/{!opp.AccountId}" target="_parent"> Edit </apex:outputLink>&nbsp;|             
                <a href="Javascript&colon;if (window.confirm('Are you sure?'))JSDeleteRecords('{!opp.Id}');"> Del </a>                                                             
            </apex:column>          
            <apex:column value="{!opp.Name}" />
            <apex:column value="{!opp.Amount}" />
        </apex:pageBlockTable>
    </apex:pageBlock>

<apex:actionFunction name="JSDeleteRecords" action="{!DeleteRecords}" reRender="form">   
    <apex:param name="oppID" value=""/></apex:actionFunction>   
</apex:form> 
</apex:page>

 

Do I need to put some JavaScript command in the rerender attribute so that the Account page will refresh?

Thanks!

Mikey

Hi,iam new to developemnt.

 

         how to create calculator on Vf page with one Text box..and remaining Buttons(like orizinal calculator)..all buttons include 1 to 10 and Symbols (+,-,*,/)..help me

 

 

Thanks in Advance

 

Nani

In Apex Language reference it is mentioned that there is a single argument constructor for Dom.Document object  accepting String, it throws error saying that constructor does not exist.

 

Code from the Apex Language Reference:

String xml = httpResponse.getBody();
Dom.Document domDoc = new Dom.Document(xml);

 

Error I am getting:

 

Error: Compile Error: Constructor not defined: [dom.Document].<Constructor>(String) at line 51 column 34

 

Did anyone see this constructor working?

 

Thanks,

Joseph

 

 

The below code is driving two dependant picklists with the second picklist being an aggregated list of campaign names.

 

Objective:

Use the aggregatedresult functionality to group campaign names by the related campaignmember.owner. Apex coding is the only way  I can achieve the intended results, using dependant upicklist fields in the UI will not meet my business requirements.

 

In trying to incorporate the aggregate / group by functionality, I am recieving the following error:

 

 

Compile Error: Invalid field campaignid for SObject AggregateResult 

 

 

Here is my code:

 

 

public with sharing class CampaignListOwner2{

    public String campaignstatus { get; set; }

    public transient string campaignlists;
    Id campaignid;
    public string s;
    
 
   /**
    *Refresh campaign list
    *@return page reference
    */
    
   
    public PageReference campaignRefresh(){
        
        return null;
    }
    

    public String getString() {
        return s;
    }
            
    public void setString(String s) {
        this.s = s;
    }

    
    


public List<SelectOption> getselectedOwner(){
        List<SelectOption> selectedOwnerList = new List<SelectOption>();
        selectedOwnerList.add(new SelectOption( '1', 'SELECT' ));
        for(User u:[select id,name from user where id in (select ownername__c from campaignmember) order by name]) {
        selectedOwnerList.add(new SelectOption(u.id, u.name));
        System.debug('************* selectedOwner id : ' + u.id);
    }
        system.debug('^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^' + selectedOwnerList);
        return selectedOwnerList;
    }

public List <SelectOption> getcampaignlists(){
    system.debug('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%' + s);
    
    AggregateResult[]groupedResults = [select
       campaignid from campaignmember where ownername__c=:s group by campaignid];
    
    List <SelectOption> campaignLists = new list<SelectOption>();
    campaignLists.add(new SelectOption( '1', 'SELECT' ));
    
    for(Aggregateresult ar :groupedResults) {
        campaignlists.add(new SelectOption(ar.campaignid, ar.name));

    }
    return campaignlists;
            
    }
}

 

 

How do I solve this error by adding the required fields to the aggregateresult sobject? If i have hit a dead end on this code. What is another way to achieve the same objective of tabulating a grouped list of campaign names driven by the campaignmember owner?

 

Thank you

I get a map of fields using getDescribe on a custom object, but standard fields such as Name or createdbyId are not listed. How do I get them?

 

currently we have code that checks to see if the Name field is updateable, but fails because Name is not included in the fields map. How can I get it?

 

 

string objectName = 'Permit__c';
Map<String, Schema.SObjectType> gdesc = Schema.getGlobalDescribe();
Sobject objectt = gdesc.get(objectName).newSObject();
Map<String, SObjectField> fields = objectt.getSObjectType().getDescribe().fields.getMap();
for (SObjectField f: fields.values())
{
        system.debug('***objectt field: ' + f);
}
Schema.DescribeFieldResult nameFieldDesc = fields.get('Name').getDescribe(); //BOOM! (null exception)
boolean m_isNameFieldUpdateable = nameFieldDesc.isUpdateable();
system.debug('***name is updateable: ' + m_isNameFieldUpdateable);

 

 

Hi All,

Is there a way to detect a particular record whether it was uploaded from Data loader or inserted through standard SF layout?

In Apex class can we differentiate a custom profile with standard profile.

We have requirement to show the list of custom profiles only.

Please let me know how this can be achieved?

 

 

I am trying to fetch the default values for the fields. I am doing

 

Schema.DescribeSObjectResult DSR = myObj__c.getSObjectType().getDescribe(); 
    			Map<String, Schema.SObjectField> CRFieldsMaps = DSR.fields.getMap();
	            for(String keyMap:CRFieldsMaps.keySet()){
	            	Schema.DescribeFieldResult descField = CRFieldsMaps.get(keyMap).getDescribe();

descField.getDefaultValue();

}

descField.getDefaultValue() returns null.

I am having date/time field with NOW() as default value.

 

If I use defaultValueFormula() this returns the formula not the value.

 

 

 

When the session expires and the visualforce page tries to reload.  I am getting the following message on visualforce page.

"Session Invalid The session in this window has become invalid.
Did you login again from another window?
Please reload the page in this window to refresh the session."

 

I did not login to anyother org.

 

I don't want to show this error on visualforce page. How can this be avioded?

If this cannot be avoided. I want to redirect the user to the login page. Can this be achieved?

 

Any help would be appreciated.

Thanks in Advance.

 

 

 

Is there a way in APEX to determine if the API is enabled for the org?

How can I check from which object the junction object is inheriting the sharing model.It simply shows controlled by parent. But from which parent.I know that the sharing model will be inherited from the first master.

 

Scenario:

I have junction object with two masters. One master "A" has public read only sharing and the other "B" has public read/write.

I need to link records of  "A" and "B". But I dont have access to A's records and hence the junction record insertion is getting failed saying "insufficient access to cross reference entity Id".

 

We have a requirement to display notes&Attachments of a particular record in Ext Js grid. How can we get the notes & Attachments of a particular record through soql and display it as a comma seperated hyper links in a table.

 

    Record              Notes&Attachments

     rec1                     n1,a1

     rec2                     n2,a2

 

 I am using

ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,'Please Enter atleast four Characters'));

 to display error message. The error message is getting displayed properly based on the condition. 

  But the following warning message is also getting dislayed some times.

The element type "td" should be terminated by the matching end-tag "</td>". at line 21

 

This is not required. How to avoid this warning message on the screen? 

I am using yahoo UI modal dialog. In that I am displaying the datatable. On each row I have a command link. on click of the command link I am displaying the record details on the parent screen. Now the problenm is when I click on the command link the list in the data table is getting initialized to null value. Why this is happening. I want to use the existing list. But this list is getting lost when I am hiding the div.

 

Any help would be appreciated

Joseph

   Hi I am suppose  to instantiate sobject dynalically based on the selected parameter. Please suggest the solution based on the given scenario.

I am having two dependant <apex:selectlist> components.

   upon the selection of the value of the selectList1 the values in the second picklist are getting populated. Here I am using <apex:actionsupport> for rerendering the second selectList.

   Now I want to retrieve the selectlist values into javascript. I am able to retrieve the values of first picklist but not the second list since it is dynamically populated from ajax response.

   The reason I want to retrieve the values into javascript is I have to instantiate teh custom based on the selected values. This cannot be done using Apex controller. In apex we cannot instantiate objects dynamically based on the parameter like in ajax new sforce.SObject("Account");

 

Thanks in Advance

Joseph

 

   

hi

Can u please explain how to pass textbox value from Visual force page to Component with in VF Page.

i had a VF Page in that i had 4 textboxes of InputFields and one apex Component control.
when user enter value in first textbox of VFPage then i have to display a datatable in the Component control in that Page.

so how can i pass value from VFPage to Component controller.

Hi,

 

I have a button on a related list . This button is calling another button that is on parent object and is hidden.This hidden button calls a S- Control.

 

Instead of hardcoding the id of hidden button in the javacript code to make a call to it , i want to get the hidden button id dynamically when the user hits the related list button(javascript is written).

 

 

I really need it very urgent !!!

  • June 07, 2009
  • Like
  • 0

i downloaded force plugin( free developer edition) for eclipse 3.3.2. I am having issue connecting to the saleforce when i am trying to create a new project.

 the error is 

 invalid login crediantials:invalid usename,password,security token;user locked out.

 

I have changed my password ,reseted my security token multiple times. My proxy setting  are to connect directly to internet and there is no personal firewall running on my machine.

 

Please let me know what can be the issue.

 

thank you