• jawtech
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 9
    Replies

Hi there, it looks like attachments are not visible on Standard and Custom objects in SF Mobile. Is there a way I can get a user to upload a picture (attachment) to a detail page (eg. Account) in Salesforce Mobile? Not sure how my custom page would work in the Mobile environment. Thanks!

 

James Wikkerink

BasicGov.com

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);

 

 

On the page layout, the number of related list records show on a detail page. From 0 to number of related records. Can we get access to that number from the detail record via a query or property of the relationship? I know we can query from the child such as:

 

 

SELECT COUNT() FROM Contact, Contact.Account
WHERE Account.name = 'MyriadPubs'

 

 

But can we get counts of related objects when querying from the parent? Something like:

 

 

SELECT Name, billingStreet, (select COUNT() FROM Contacts) from Account
WHERE Account.Id = '1234567890kje'

 

 

I am accessing the chatter object feedtrackedchange and presenting them in our own custom ui. We want to present all of an object's feed change records grouped by the changed date. Is it possible to group them all together using the date or is there a better idea?

 

For example, we have chatter turned on for 2 fields on the Account object. When both fields are changed we want to present the tracked changes together rather than each each seen as a separate feed changes. Should I use the date to relate these two changes together or is there another field I should be using?

 

James

BasicGov.com

  • September 22, 2010
  • Like
  • 0

Hi there, I am making a large GET httprequest to an external REST service. The amount of output data to be streamed is about 10000 characters. I can paste the URL in my browser address and I get the response just fine. However using httprequest in apex causes the destination server to say partial URL. Is there no way to stream data in 5000 chunks for example in Apex? Say something similar to this jsp page? the apex httprequest object doesn't seem to have much functions for streaming

 

 

HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setDoOutput(true);
con.setRequestMethod(request.getMethod());
int clength = request.getContentLength();
if (clength > 0) {
    con.setDoInput(true);
    InputStream istream = request.getInputStream();
    OutputStream os = con.getOutputStream();
    final int length = 5000;
    byte[] bytes = new byte[length];
    int bytesRead = 0;
    while ((bytesRead = istream.read(bytes, 0, length)) > 0) {
	os.write(bytes, 0, bytesRead);
    }
}
out.clear();
out = pageContext.pushBody();
OutputStream ostream = response.getOutputStream();

// Return content type
String contentType = con.getContentType();
response.setContentType(contentType);
// Override content types with known issues
if (contentType != null) {
	for (int i = 0; i < contentTypesToMapToXml.length; i++) {
		if (contentType.indexOf(contentTypesToMapToXml[i]) >= 0) {
			response.setContentType("application/xml");
			break;
		}
	}
}
InputStream in = con.getInputStream();
final int length = 5000;
byte[] bytes = new byte[length];
int bytesRead = 0;
while ((bytesRead = in.read(bytes, 0, length)) > 0) {
    ostream.write(bytes, 0, bytesRead);
}

 

 

Is there any way using any tools to evaluate javascript code (a retrieved string) inside Apex? Ideally I'm looking for something similar to the eval function of javascript but run within Apex.

 

thanks!

 

James

 

Cloudbench Applications

providers of BasicGov.com

 

I know I can include numerous components inside a visualforce page with bindings to the appropriate fields. However, using a visualforce page forces our clients into a particular page layout. Is there a way to include visualforce components inline on a regular page layout (using the same component multiple times, but with different field bindings?).

 

Effectively, I would like to create my own field type with it's own ui behavior and include them on SF page layouts. Is this possible?

  • September 16, 2009
  • Like
  • 0

Hi. We have a fairly large managed package. Well over 600 fields, 40 objects and about 22 tabs. We are planning on adding in new services. Is the 25 tab number a hard line and we'll have split up our app into multiple managed packages? (one dependent on the other). What is the best way to go about this?

 

James

BasicGov.com

  • September 01, 2009
  • Like
  • 0

I have a workflow rule that triggers fine off of a object record created. If I insert the same record through Visualforce and the Apex controller, the workflow does not trigger. Does workflow not trigger from an apex controller? The most frustrating thing is that the workflow does run in my developer account, but not in an account we released the managed code into. It is impossible to debug this.

 

I phoned Salesforce support and they said workflow doesn't trigger from Visualforce because it on a different domain. What? Why would I use visualforce when we use workflow?

What options do I have for users to be able to see formula values in edit mode? So far, I can only see the calculations in View mode. I'm open to anything even using an inline flex control or anything. Any ideas?

I'm auto-creating a task reminder from the activity date.

 

I would like to take the value of the activitydate field and put it into the reminderdatetime field (datetime). What do I need to do to the date so I don't get the error "Illegal assignment from Date to Datetime". Convert it? Cast it? Format it?

for(Task ti : t){ //for each task

ti.put('ReminderDateTime',ti.ActivityDate);

ti.put('isReminderSet', true);

}

 

Message Edited by jawtech on 04-02-2009 08:17 PM

We already have an online help repository. What could my "custom help" scontrol do to forward the user to the particular help content when they click on "Help for this Page"?

 

The help is already organized into a page for each Salesforce screen. Could I build *one* help scontrol that knows what screen Help for this Page was clicked and forward to the right content page?

 

Any best practices regarding this?

 

James Wikkerink

Cloudbench Applications

Is it possible to either run a report or retrieve a report meta data through the API? If so where would the definition of the reports syntax be defined?

 

I would like to drive code based on how my users have set filter criteria on certain reports.

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);

 

 

Is there a method of dynamically setting the type of sObject from a generic?

 

sObject myObj = new sObject();

and then later in code set the type from a string? The goal is to allow the user to specify the object and filed being manipulated by the Apex class. I already have code to allow a dynamic field name, but the sObject definition is giving me trouble.

 

 

Schema.getGlobalDescribe().get('Contact').newSObject();

 works somewhat but it returns a generic sObject and needs to be recast before it can be of any use.

 

 

Message Edited by Vintara on 03-20-2009 01:59 PM

I'm working on a VF page that will determine the object type of an ID passed to it. The ID is a salesforce id which could be any object type (Account, Contact, etc).

 

I can't seem to get from here to there through Apex. I've check the describe calls but I can't find something that let's me create an object based on an ID and determine its type...

 

My only other option looks like the last resort of looping through ALL object types and trying a select query against each type.

 

Any ideas on this?

 

Below is the pseudocode of what I don't want to do. If I go this route, I'm going to hit the 100-SOQL-call limit very quickly. Feels like there must be a better way.

 

String objectID = getParameter('id');

String objectTypeName = '';

foreach(sObjectType type in types) {

sObject testObject = Database.query('SELECT Id FROM ' + type.Name + ' WHERE ID = "' + objectID + '"');

 

if(sObject.id != '') {

objectTypeName = type.Name;

break;

}

}

  • February 27, 2009
  • Like
  • 0

Is it possible to either run a report or retrieve a report meta data through the API? If so where would the definition of the reports syntax be defined?

 

I would like to drive code based on how my users have set filter criteria on certain reports.

I am trying to use a custom s-control to take the data from an existing lead, and create a new ‘candidate’ (a custom object) - for those people that fill out a form online, but are looking for a job, not our services.  I am able to have the custom s-control open up the ‘new candidate’ window, but I can’t get any of the data to populate.  What am I doing wrong?  How do I make it so that sfdc knows to pull the data from the lead record?

I currently have:

{!URLFOR($Action.Candidate__c.New)},%{!Candidate__c.Name}={!Lead.FirstName}

Any help would be greatly appreciated!

  • October 22, 2008
  • Like
  • 0