• johncusackjr
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 18
    Replies

Hi,

 

I'm trying to implement a custom search screen for a custom object based on fields.

 

And i'm planning to use inputField to get the field query. inputField should display correct widget based on the type  (if it's  date, date picker, if a user lookup user selector etc.) But it does not display anything for read only fields (like Last Modified Date etc.). What might be the reason and also how can I implement this?

 

Thanks,

John

Hi,

I have two wrappers, one for SObject objects, one for field types. Based on the field type I need to retrieve the Sobject field value inside VisualForce page.

 

For example:

 <apex:repeat value="{!fieldsWrapper}" var="field" id="customFieldRepeater">
        <apex:column headerValue="{!field.label}" value="{!f.mySobject.get(field.id).value}"/>
        </apex:repeat>

 But this is giving Syntax error. Extra '.' error.

 

Is there a way to do this in VF page, or do i miss something?

 

Thanks,

John

Hi,

I have a component and a componentcontroller.

I am calculating a value in controller and using the value in component.

 

Page has a command button:

<apex:commandButton action="{!calculateSelectedIdNamePairs}" onClick="initMe();"
            value="Button" reRender="initDownload" />

 

and a div that contains script

 

<div id="initDownload">
 <script>       
       // some javascript that opens an applet with parameters

       function initMe()

       {

            var popup = window.open("AppletPage?selectedIdNamePairs={!selectedIdNamePairs}", "downloadManager", "width=610,height=410");

       }
 </script>
  </div>

 

But when i inspect the page i saw that, it is trying to open a page "AppletPage?selectedIdNamePairs=" So selectedIdNamePairs is blank. I checked the component controller using System.debugs and it is returning values correctly.

 

I am not sure this code is updating the page partially to use my selectedIdNamePairs value in onClick or onComplete.

 

How can I achieve this?

 

Thanks,

John

Hi,

 

I would like to make an external RESTful web service call using PUT method. The service accepts file data as the body of the http request. When I use HttpRequest.setBody(‘some text’), this works and external service understands this.

 

However, when I try to read a blob (such as a document body in salesforce) and upload that such as HttpRequest.setBody(blobData.toString()), the service gets corrupted data.

 

For example:

List<Document> docs = [select body from document where ID = 'someId'];
System.debug('RETURN: ' +MyCustomUtil.createFile('testImage.jpg',EncodingUtil.base64Encode(docs[0].body),'image/jpeg'));
System.debug('URL:::' + MyCustomUtil.getURL('testImage.jpg'));

 

Is there a better way to do this? I tried encoding-decoding this blob data with EncodingUtil class but I couldn’t get anywhere. I would like to see an example where binary data can be send to an external RESTful service.

 

Thanks,

John

Hi all,

 

How can I tell my Visualforce page is accessed from customer portal?
Is there a profile, permission or system flag that i can check?

 

Thanks,

John

Hi,

 

I have two custom objects: CustomObject1 and CustomObject2. CustomObject2 is related to CustomObject1 using a Master-Detail relationship.

 

Then I am giving Public Read Only access to this object for some profiles from Sharing Rules. But  when I logged in with that profileuser can delete, edit, create like he has Read/Write access. This scenario works for standard object's master-detail custom objects (eg. Account has a Custom Account Object)

 

Is there a restriction for the custom objects or did i make a  configuration mistake?

 

Thanks,

John.

Hi,

 

Is there a way to get the "Allow Activities" option value is set or not for a custom object?

 

I want to set the whatId on the custom object during email and it fails if allow activities is not selected.

 

Thanks,

John

Hi,

I am developing an application using Flex and Salesforce. In my custom component controller I am using

 

 

ApexPages.currentPage().getUrl();

 

 to retrieve current page url. After completing flex stuff, I am returning to the current page using this return url.

 

This is working in my Developer organization which has a namespace prefix.

 

But when my customer installs this managed package and uses this custom component inside their custom visualforce page it is appending my namespace prefix to it, instead that custom page and my customer environment does not have a namespace prefix.

 

So when user clicks OK button it is trying to return to https://c.na7.visual.force.com/apex/MYDEVELOPMENTNAMESPACE__MyCustomPage....

but the page stays at  https://c.na7.visual.force.com/apex/MyCustomPage....

 

How can I solve this problem? Is there a dynamic way to solve this problem or do i need to get the url as string then split and remove namespace?

 

Thanks in advance,

John

 

PS.: If this is a bug and there is no solution, I'm planning to use history.go(-1); in my javascript call. Does that cause a problem?
Message Edited by johncusackjr on 12-07-2009 04:52 AM

Hi,

 

I have a Flex application working with Salesforce.com. Based on object name I am doing some calculations in Flex side.

 

Standard objects don't require namespace prefix (e.g. xyz__) when controlling, but custom objects require it. So when I try to make a decision based on object name I need to create this logic:

 

if(Account) { } else if(Opportunity) { } ... else if(xyz_MyCustomObject__c) { }

 

 

But to do this I need to know the xyz namespace prefix. If I hardcode it, it won't be useful for other customers that install my application. Because they'll be able to create their custom objects and my flex app will handle their needs just based on custom object name.

 

Is there any solution to retrieve namespace prefix dynamically or refer the custom object without namespace prefix?

 

Thanks,

John

Hi,

 

In one of my controller classes I need to retrieve Created By Name field from a custom object.

 

I am running

 

String queryString = 'Select id, File_Name__c, CreatedById, CreatedBy.Name, CreatedDate from ...';

 

Querying the custom object and putting fields in a list:

 

List<SObject> myList = Database.query(queryString);

 

Then trying to set the created by name to a wrapper class field in a loop over myList:

 

w.setCreatedByName((String)f.get('CreatedBy.Name'));

 

But it is giving me

 

Invalid field CreatedBy.Name for XYZ__c

 

What might be the problem. How can I retrieve CreatedBy.Name. I can retrieve CreatedById directly but it is not solving my problem.

 

Thanks...

Hi,

 

I'm trying to implement a custom search screen for a custom object based on fields.

 

And i'm planning to use inputField to get the field query. inputField should display correct widget based on the type  (if it's  date, date picker, if a user lookup user selector etc.) But it does not display anything for read only fields (like Last Modified Date etc.). What might be the reason and also how can I implement this?

 

Thanks,

John

Hi,

I have two wrappers, one for SObject objects, one for field types. Based on the field type I need to retrieve the Sobject field value inside VisualForce page.

 

For example:

 <apex:repeat value="{!fieldsWrapper}" var="field" id="customFieldRepeater">
        <apex:column headerValue="{!field.label}" value="{!f.mySobject.get(field.id).value}"/>
        </apex:repeat>

 But this is giving Syntax error. Extra '.' error.

 

Is there a way to do this in VF page, or do i miss something?

 

Thanks,

John

Hi,

I have a component and a componentcontroller.

I am calculating a value in controller and using the value in component.

 

Page has a command button:

<apex:commandButton action="{!calculateSelectedIdNamePairs}" onClick="initMe();"
            value="Button" reRender="initDownload" />

 

and a div that contains script

 

<div id="initDownload">
 <script>       
       // some javascript that opens an applet with parameters

       function initMe()

       {

            var popup = window.open("AppletPage?selectedIdNamePairs={!selectedIdNamePairs}", "downloadManager", "width=610,height=410");

       }
 </script>
  </div>

 

But when i inspect the page i saw that, it is trying to open a page "AppletPage?selectedIdNamePairs=" So selectedIdNamePairs is blank. I checked the component controller using System.debugs and it is returning values correctly.

 

I am not sure this code is updating the page partially to use my selectedIdNamePairs value in onClick or onComplete.

 

How can I achieve this?

 

Thanks,

John

Hi,

 

I would like to make an external RESTful web service call using PUT method. The service accepts file data as the body of the http request. When I use HttpRequest.setBody(‘some text’), this works and external service understands this.

 

However, when I try to read a blob (such as a document body in salesforce) and upload that such as HttpRequest.setBody(blobData.toString()), the service gets corrupted data.

 

For example:

List<Document> docs = [select body from document where ID = 'someId'];
System.debug('RETURN: ' +MyCustomUtil.createFile('testImage.jpg',EncodingUtil.base64Encode(docs[0].body),'image/jpeg'));
System.debug('URL:::' + MyCustomUtil.getURL('testImage.jpg'));

 

Is there a better way to do this? I tried encoding-decoding this blob data with EncodingUtil class but I couldn’t get anywhere. I would like to see an example where binary data can be send to an external RESTful service.

 

Thanks,

John

Hi all,

 

How can I tell my Visualforce page is accessed from customer portal?
Is there a profile, permission or system flag that i can check?

 

Thanks,

John

Hi,

 

I have a Flex application working with Salesforce.com. Based on object name I am doing some calculations in Flex side.

 

Standard objects don't require namespace prefix (e.g. xyz__) when controlling, but custom objects require it. So when I try to make a decision based on object name I need to create this logic:

 

if(Account) { } else if(Opportunity) { } ... else if(xyz_MyCustomObject__c) { }

 

 

But to do this I need to know the xyz namespace prefix. If I hardcode it, it won't be useful for other customers that install my application. Because they'll be able to create their custom objects and my flex app will handle their needs just based on custom object name.

 

Is there any solution to retrieve namespace prefix dynamically or refer the custom object without namespace prefix?

 

Thanks,

John

Hi,

 

In one of my controller classes I need to retrieve Created By Name field from a custom object.

 

I am running

 

String queryString = 'Select id, File_Name__c, CreatedById, CreatedBy.Name, CreatedDate from ...';

 

Querying the custom object and putting fields in a list:

 

List<SObject> myList = Database.query(queryString);

 

Then trying to set the created by name to a wrapper class field in a loop over myList:

 

w.setCreatedByName((String)f.get('CreatedBy.Name'));

 

But it is giving me

 

Invalid field CreatedBy.Name for XYZ__c

 

What might be the problem. How can I retrieve CreatedBy.Name. I can retrieve CreatedById directly but it is not solving my problem.

 

Thanks...

How do i resolve this...This is my code...I am sending an XML to an endpoint n number of times(its in a for loop)...Cant i do that?

public PageReference saveUsers() {
String[] listOfSelectedUsers = getUsers();
String domainId = System.currentPageReference().getParameters().get('ex');
for(String presentVar: listOfSelectedUsers)
{

Http h = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint('http://84.40.30.147/cm/spws');
req.setMethod('POST');

TestExtranet__c extranet = [select Extranet_Name__c from TestExtranet__c where id = :domainId];
Lead lead = [select id,firstname,lastname,email from Lead where id = :presentVar];
String requestXML = buildXMLRequest('createUser',extranet.Extranet_Name__c,lead.id,lead.firstname,lead.lastname,lead.email);

req.setBody(requestXML);
HttpResponse res = h.send(req);
XmlStreamReader reader = res.getXmlStreamReader();
boolean errorExists = parseResponseForError(reader);
if(!errorExists)
{
Extranet_User_Mapping__c mapping = new Extranet_User_Mapping__c();
mapping.Extranet_Id__c = domainId;
mapping.Leads__c = presentVar;
insert mapping;
}else
{

}


}
PageReference userConfPage = new PageReference('/apex/userConfirmation?ex='+ System.currentPageReference().getParameters().get('ex'));
return Page.userConfirmation;
}