• cloud-development
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 8
    Replies

Hi All,

 

Previously I have created quite a few custom lookups for different objects, all being called from Visualforce pages. I recently had to have a custom lookup operate on a standard page, so thought it would be nice if I could create a generic lookup handler, and add something to the sidebar as a hompepage component, to allow it to work with standard pages.

 

All was going well until I tried to return the lookup value back to the field on the standard page, where I noticed an error in the console:

 

Unsafe JavaScript attempt to access frame with URL https://c.cs13.visual.force.com/apex/CustomLookup?frm=editPage&lookupType=003&lksearch=&lksrch=andy&txt=CF00NW0000000HBjZ&accId=001W0000004zzyP from frame with URL https://cs13.salesforce.com/a06/e?CF00N20000002GKe3=Andy+Jones&CF00N20000002GKe3_lkid=001W0000004zzyP&retURL=%2F001W0000004zzyP. Domains, protocols and ports must match.

 

Is there a way around the XSS being applied here? Will I never be able to call a VF page from a standard page and have JS pass values back to the parent?

 

Is injecting a modal or similar from the sidebar a better approach for displaying the custom lookup, to avoid having to use VF?

 

Appreciate any help you can provide!

 

Cheers,

Andrew

 

All,

 

I'm fairly new to webservices in Apex, so hoping someone might be able to help me understand an error I'm getting.

 

I have used WSDL2Apex to generate some classes, and am able to use them to build up a request, which I'm trying to send.

 

However I'm getting the following response error - "The string '' is not a valid AllXsd value".

 

My XML request below looks ok to me. Is the error on the Salesforce side, or is the service genuinely having a problem with parsing the request? I've seen various posts where this error can mean problems parsing dates, but I get the same error even when removing all the dates.

 

Hoping you can help!

 

Cheers,

Andrew

 

<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><env:Header /><env:Body><PlaceOrders xmlns="http://ws.bbtrack.com/OrderInterface/"><Orders><OrderType><Version>1</Version><CustomerInformation><Name>Test</Name><ReferralCode>blah</ReferralCode><Password>blah</Password></CustomerInformation><Reference>a0XF00000032rZPMAY</Reference><OrderDate>2011-12-13T10:20:03.262Z</OrderDate><CRD>2011-12-13T10:20:03.262Z</CRD><DeliveryMethod><Carrier>Royal Mail</Carrier><Service>FCP</Service><DespatchDate /></DeliveryMethod><DeliveryParty><Party><Ident>test123</Ident><FirstName>test</FirstName><LastName>test</LastName><Telephone>0131</Telephone><CompanyName>test account</CompanyName><EmailAddress>test@me.com</EmailAddress></Party><Address><PremisesName>test account</PremisesName><AddressLine2>test</AddressLine2><AddressLine3>test</AddressLine3></Address></DeliveryParty><SupplierPartList><SupplierPart><SupplierPartType><PartName>585</PartName><PartSku>585</PartSku><PartCount>1</PartCount><Configuration><ConfigurationItem><ConfigurationItemType><ConfigName>SERVICE ID</ConfigName><Value>12345</Value></ConfigurationItemType><ConfigurationItemType><ConfigName>IP BASE</ConfigName><Value>62.43.56.66</Value></ConfigurationItemType><ConfigurationItemType><ConfigName>INETNUM</ConfigName><Value>62.43.56.66 - 62.43.56.66</Value></ConfigurationItemType><ConfigurationItemType><ConfigName>HOSTNAME</ConfigName><Value>TEST</Value></ConfigurationItemType><ConfigurationItemType><ConfigName>PASSWORD</ConfigName><Value>TEST</Value></ConfigurationItemType><ConfigurationItemType><ConfigName>ORDER TYPE</ConfigName><Value>Reseller</Value></ConfigurationItemType></ConfigurationItem></Configuration></SupplierPartType></SupplierPart></SupplierPartList></OrderType></Orders></PlaceOrders></env:Body></env:Envelope>

All,

 

I have some standard code in place to auto-submit cases for approval when they are created. This is working fine.

 

We are now hoping to incude the approvals in the chatter feed for the case record, as well as the approvers user feed.

 

If I remove my auto-submit code and submit the record for approval manually, it appears in the chatter feed as expected. However with code in place, it does not appear to work.

 

Code below:

 

if(c.Type=='IT - Request' && c.Status=='Open' && c.Origin == 'Web') {

List<Contact> contacts = [ select id, thus_manager__c from Contact where email =: c.suppliedEmail limit 1 ];

 

if(contacts[0].Thus_Manager__c != null) {

Approval.ProcessSubmitRequest req =  new Approval.ProcessSubmitRequest();

req.setComments('Auto submitting IT Request Case for Managers approval');

req.setObjectId(c.id);

req.setNextApproverIds(new ID[] {contacts[0].thus_manager__c} );

Approval.ProcessResult result = Approval.process(req);

} else {

c.addError('The associated contact has no manager listed - the case cannot be raised.');

}

}

 

Am I missing something obvious that I need to make Chatter work?

 

Cheers,

Andrew

 

Based in Scotland and can't find resource for your Salesforce and Force.com projects?

 

Cloud-development are an Edinburgh based consultancy, providing support to companies of all sizes across Scotland.

 

Visit www.cloud-development.co.uk to get in touch.

Hi,

 

Edinburgh based Force.com developer, with 3 experience years of Apex and Visualforce, available for remote freelance work across the UK.

 

If interested, please get in touch:  info(at)cloud-development.co.uk

 

 

 

 

Hi All,

 

Previously I have created quite a few custom lookups for different objects, all being called from Visualforce pages. I recently had to have a custom lookup operate on a standard page, so thought it would be nice if I could create a generic lookup handler, and add something to the sidebar as a hompepage component, to allow it to work with standard pages.

 

All was going well until I tried to return the lookup value back to the field on the standard page, where I noticed an error in the console:

 

Unsafe JavaScript attempt to access frame with URL https://c.cs13.visual.force.com/apex/CustomLookup?frm=editPage&lookupType=003&lksearch=&lksrch=andy&txt=CF00NW0000000HBjZ&accId=001W0000004zzyP from frame with URL https://cs13.salesforce.com/a06/e?CF00N20000002GKe3=Andy+Jones&CF00N20000002GKe3_lkid=001W0000004zzyP&retURL=%2F001W0000004zzyP. Domains, protocols and ports must match.

 

Is there a way around the XSS being applied here? Will I never be able to call a VF page from a standard page and have JS pass values back to the parent?

 

Is injecting a modal or similar from the sidebar a better approach for displaying the custom lookup, to avoid having to use VF?

 

Appreciate any help you can provide!

 

Cheers,

Andrew

 

Hi,

 

We are looking for a uk based developer who can assit with various projects, developer must be able to attend meeting when required (all paid for)

 

If this sounds liek something you are intertested in please respond to this add

 

Sean

Hi,

 

I need a UK based developer for some coding for a couple of days.

 

if you're interested or want some more information please contact me.

 

thanks

 

charlie

Based in Scotland and can't find resource for your Salesforce and Force.com projects?

 

Cloud-development are an Edinburgh based consultancy, providing support to companies of all sizes across Scotland.

 

Visit www.cloud-development.co.uk to get in touch.

Hi,

   I created Page for custom save controller. my page apex code given below...

 

<apex:page controller="newOpportunityController11" tabStyle="Account">
<apex:form >
<apex:pageBlock title="Congratulations">
<apex:inputField value="{!Invoice.Name}"/>
<apex:inputField value="{!Invoice.Line_Item__c}"/>
<apex:inputField value="{!Invoice.Pay_by_Date__c}"/>
<apex:inputField value="{!Invoice.Total_Amount__c}"/>
<apex:inputField value="{!Invoice.Client_Name__c}"/>
<apex:inputField value="{!Invoice.Invoice_Status__c}"/>
<apex:commandButton action="{!save}" value="Save"/>
<apex:commandButton action="{!cancel}" value="Cancel"/>
</apex:pageBlock>
</apex:form>
</apex:page>
and my apex class is...
public class newOpportunityController11
 {  
Opportunity opportunity;
public Invoice__c invoice{ get; set; }
public Opportunity getOpportunity() {
//if(opportunity == null) opportunity = new Opportunity();
return opportunity;
}
public Invoice__c getinvoice() {
//if(Invoice == null) Invoice = new Invoice__c();
Id id = ApexPages.currentPage().getParameters().get('id');
invoice= [SELECT Client_Name__c,Invoice_Status__c,Line_Item__c,Pay_by_Date__c,Total_Amount__c FROM Invoice__c WHERE id = :id];
return invoice;
}
public PageReference cancel() {
PageReference opportunityPage = new ApexPages.StandardController(opportunity).view();
opportunityPage.setRedirect(true);
return opportunityPage;
}
public PageReference save() 
{
update invoice;
return null;
}
}
the above page and class was successfully save without error... and then when i run this page and enter the data then click save button the error given below error is occur...
System.NullPointerException: Attempt to de-reference a null object

 

Class.newOpportunityController11.save: line 47, column 8 External entry point
How to solve this....pls help

 

 

 

 

 

  • January 25, 2011
  • Like
  • 0

Wanted Salesforce Developer: Resource

 

I would like an indication of your pricing for salesforce CRM development.

 

Background: We are an SME software vendor in Southwest London using Salesforce internally for sales and client support. We require assistance in making the software further aligned to our requirements. Our understanding is the development would be a quite short job but would like to find someone of quality since we may have additional requirements after the first phase is completed.

Please respond urgently as we are looking to progress very soon.

Sincerely,

 

Damian

 

When developing a Visualforce page for overiding view page for any object, one problem that creeps up is to display the History details of a record. The standard related list Component doesn't works for History.

 

With the help of some code from Community ( I now can't find the link to it :( ), I wrote my own code  then to display the history of an object. It mimics the standard list as far as possible.  

 

Heres the code. It is for the Case object but it can be used for any other object.

 1.Component Code

 

<apex:component controller="CaseHistoriesComponentController">
<!-- Attribute Definition -->
<apex:attribute name="CaseId" description="Salesforce Id of the Case whose Case History needs to be rendered" type="Id" required="true" assignTo="{!caseId}" />

<!-- Case History Related List -->
<apex:pageBlock title="Case History">
<apex:pageBlockTable value="{!histories}" var="History" >
<apex:column headerValue="Date" value="{!History.thedate}"/>
<apex:column headerValue="User"> <apex:outputLink value="/{!History.userId}"> {!History.who} </apex:outputLink></apex:column>
<apex:column headerValue="Action"><apex:outputText escape="false" value="{!History.action}"/></apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:component>

 

 

 

 

2. Apex Code

 

public class CaseHistoriesComponentController {

public Id caseId {get; set;}
public cHistories[] histories;

// Variables
public Static final Map<String, Schema.SObjectField> CaseFieldmap = Schema.SObjectType.Case.fields.getMap();
public Static final List<Schema.PicklistEntry> fieldPicklistValues = CaseHistory.Field.getDescribe().getPicklistValues();

public List<cHistories> getHistories()
{
list<cHistories> histories = new list<cHistories>();
String prevDate = '';
for(CaseHistory cHistory : [Select CreatedDate, CreatedBy.Name, CreatedBy.Id, Field, NewValue, OldValue from CaseHistory where CaseId = :caseId order by CreatedDate desc])
{
if((cHistory.newValue == null && cHistory.oldValue == null)
|| (cHistory.newValue != null && !(string.valueOf(cHistory.newValue).startsWith('005') || string.valueOf(cHistory.newValue).startsWith('00G')))
|| (cHistory.oldValue != null && !(string.valueOf(cHistory.oldValue).startsWith('005') || string.valueOf(cHistory.oldValue).startsWith('00G'))))
{
cHistories tempHistory = new cHistories();
// Set the Date and who performed the action
if(String.valueOf(cHistory.CreatedDate) != prevDate)
{
tempHistory.theDate = String.valueOf(cHistory.CreatedDate);
tempHistory.who = cHistory.CreatedBy.Name;
tempHistory.userId = cHistory.CreatedBy.Id;
}
else
{
tempHistory.theDate = '';
tempHistory.who = '';
tempHistory.userId = cHistory.CreatedBy.Id;
}
prevDate = String.valueOf(cHistory.CreatedDate);

// Get the field label
String fieldLabel = CaseHistoriesComponentController.returnFieldLabel(String.valueOf(cHistory.Field));

// Set the Action value
if (String.valueOf(cHistory.Field) == 'created') { // on Creation
tempHistory.action = 'Created.';
}
else if(cHistory.OldValue != null && cHistory.NewValue == null){ // when deleting a value from a field
// Format the Date and if there's an error, catch it and re
try {
tempHistory.action = 'Deleted ' + Date.valueOf(cHistory.OldValue).format() + ' in <b>' + fieldLabel + '</b>.';
} catch (Exception e){
tempHistory.action = 'Deleted ' + String.valueOf(cHistory.OldValue) + ' in <b>' + fieldLabel + '</b>.';
}
}
else{ // all other scenarios
String fromText = '';
if (cHistory.OldValue != null) {
try {
fromText = ' from ' + Date.valueOf(cHistory.OldValue).format();
} catch (Exception e) {
fromText = ' from ' + String.valueOf(cHistory.OldValue);
}
}

String toText = '';
if (cHistory.OldValue != null) {
try {
toText = Date.valueOf(cHistory.NewValue).format();
} catch (Exception e) {
toText = String.valueOf(cHistory.NewValue);
}
}
if(toText != '')
tempHistory.action = 'Changed <b>' + fieldLabel + '</b>' + fromText + ' to <b>' + toText + '</b>.';
else
tempHistory.action = 'Changed <b>' + fieldLabel;
}

// Add to the list
histories.add(tempHistory);
}
}

return histories;
}

// Function to return Field Label of a Case field given a Field API name
public Static String returnFieldLabel(String fieldName)
{
if(CaseHistoriesComponentController.CaseFieldmap.containsKey(fieldName))
return CaseHistoriesComponentController.CaseFieldmap.get(fieldName).getDescribe().getLabel();
else
{
for(Schema.PicklistEntry pickList : fieldPicklistValues)
{
if(pickList.getValue() == fieldName)
{
if(pickList.getLabel() != null)
return pickList.getLabel();
else
return pickList.getValue();
}
}
}
return '';
}
// Inner Class to store the detail of the case histories
public class cHistories {

public String theDate {get; set;}
public String who {get; set;}
public Id userId {get; set;}
public String action {get; set;}
}
}

  Let me know your views on the code or if you have any questions

 

javascript: openLookup('/_ui/common/data/LookupPage?lknm=CF00N30000001BYw0&lkfm=editPage&lktp=' + document.getElementById('CF00N30000001BYw0_lktp').value,670,document.getElementById('CF00N30000001BYw0_mod').value,'&lksrch=' + escapeUTF(document.getElementById('CF00N30000001BYw0').value),'maxw')
  • April 19, 2006
  • Like
  • 1