• meyerd
  • NEWBIE
  • 25 Points
  • Member since 2007

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

Hi..

Need some help here...Im using API to insert Task. But every time I create task using API the email notification will not be send to the Owner of the TASK. Even I set send email notification as default in UI, when I try to load using API its still not work...

 

Appreciate if anyone can give me an advise or guideline regarding this issue.

 

Thank you in advance!

Message Edited by Ninie on 07-09-2009 02:34 AM
  • July 09, 2009
  • Like
  • 0

The following code works in Apex Rest enabled sandbox.

However after deploying the same code to production it returns

 

[ {
  "message" : "Could not find a match for URL /MyTask",
  "errorCode" : "NOT_FOUND"
} ]

 

@RestResource(urlMapping='/MyTask/*')
global with sharing class TaskResource {
    @HttpGet
    global static Task[] doGet(RestRequest req, RestResponse res){
        Task[] result = [Select  Id, Subject, Status, ActivityDate, Priority, Description, WhatId, What.Name
                  From Task
                   where Status <> 'Completed' and ownerid = :UserInfo.getUserId() order by activitydate];
        return result;
    }
}

 

/salesforce.com/services/apexrest/MyTask

 

 

Suggestions?

 

 

Any way to serve manifest files from SFDC, static resource, vf page, other with mime type 'text/cache-manifest'?

  • August 09, 2010
  • Like
  • 0
  • Starting with a picklist that is sorted alpha  “ Sort values alphabetically, not in the order entered.”
  • V19 of the metadata wsdl

1)      add a value through the metadata api.

2)      add a value through the metadata api and setSorted(true); to the pl in the code.

 

In both 1) and 2) this value shows as the first value even though by alpha it would not be. Suggestions?

 

 

System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ");
long waitTimeMilliSecs = 1000;

String objectName = "MyObject__c";
String fieldName = "MyPickListField__c";
String fieldLabel = "MyPickListField";

HashSet<String> ValuesToProcess = new HashSet<String>();

ValuesToProcess.add("NewPickListValue");

CustomField field = new CustomField();
field.setFullName(objectName + "." + fieldName);

field.setType(FieldType.Picklist);

field.setLabel(fieldLabel);
Picklist PicklistToManipulate = new Picklist();

PicklistValue tmpPicklistValue = new PicklistValue();
String toAdd;
Integer i = 0;

Iterator<String> processIterator = ValuesToProcess.iterator();
PicklistValue[] allPicklistValues = new PicklistValue[ValuesToProcess.size()];

while (processIterator.hasNext()) {
	toAdd = processIterator.next();
	System.out.println("to add " + toAdd);
	tmpPicklistValue = new PicklistValue();
	tmpPicklistValue.setFullName(toAdd);
	allPicklistValues[i++] = tmpPicklistValue;
}
PicklistToManipulate.setPicklistValues(allPicklistValues);

//setSorted?
System.out.println("setSorted(true)");
PicklistToManipulate.setSorted(true);		

field.setPicklist(PicklistToManipulate);


UpdateMetadata updateMetadata = new UpdateMetadata();
updateMetadata.setMetadata(field);
updateMetadata.setCurrentName(objectName + "." + fieldName);

AsyncResult[] ars;
try {
	ars = metadatabinding.update(new UpdateMetadata[] { updateMetadata });

	AsyncResult asyncResult = ars[0];
	while (!asyncResult.isDone()) {
		Thread.sleep(waitTimeMilliSecs);
		// double the wait time for the next iteration
		waitTimeMilliSecs *= 2;
		asyncResult = metadatabinding.checkStatus(new String[] { asyncResult.getId() })[0];
		System.out.println("Status is: " + asyncResult.getState());
	}
	if (asyncResult.getState() != AsyncRequestState.Completed) {
		throw new Exception(asyncResult.getStatusCode() + " msg: " + asyncResult.getMessage());
	}

} catch (Exception e) {
	e.printStackTrace();
}

 

 

How can I monitor the total number future method calls used versus the limit of

No more than 200 method calls per Salesforce license per 24 hours?

 

 

 

 

 

  • January 30, 2009
  • Like
  • 0
I have a visual force page that gets select options from a controller.
I have required="true" for the selectList.
No red bar shows on the page when it is displayed.
If I don't select a value and submit the form.
I do not get a message on the field 'You must enter a value' like I do on other fields required in the same way, but do get informed in  apex:pageMessages mentioning

thePage:theForm:j_id1:j_id5:0: Validation Error: Value is required.

The field is a multiselect picklist which I am showing on the VF page as a selectList size 1 only when the user has not previously selected values for that field.

Code:
<apex:page standardController="Opportunity" recordSetVar="opportunities" sidebar="false" showHeader="true" extensions="OpptyMultiEdit_CTE" id="thePage">
......
<apex:pageBlockTable value="{!OpptyList}" var="oppty" cellpadding="4" headerClass="TH_Class">
......
<apex:selectList required="true" size="1" value="{!oppty.Competitors__c}">
<apex:selectOptions value="{!CompetitorsPicklist}"/>
</apex:selectList>



Opportunity[] Opptys;
public List<Opportunity> getOpptyList()
{
return Opptys;
}

public List<SelectOption> getCompetitorsPicklist()
{
List<SelectOption> options = new List<SelectOption>();
Schema.DescribeFieldResult f = Opportunity.Competitors__c.getDescribe();
String defValue = '';
options.add( new SelectOption( '', '--None--'));
for(Schema.PicklistEntry pe : f.getPicklistValues())
{
if ( pe.getValue() != Competitors )
{
options.add( new SelectOption( pe.getValue(), pe.getLabel() ));
}
}
return options;
}

Ideas on
-why the red bar not showing?
-why is the field not being Highlighted and marked with 'Error: You must enter a value' when I submit the form?





  • December 08, 2008
  • Like
  • 0
I have a field which shows the translated labels based on the users language.

In a Visual Force page I see how to show the translated label for an output field.
How would I show the translated label as the column header for an input field which has an onchange event?

    <apex:pageBlockTable value="{!OpptyList}" var="oppty" cellpadding="4">
        <apex:column headerValue="Stage"> 
            <apex:inputField value="{!oppty.stageName}" id="OPPTY_STAGE" onchange="changeFcstStatus(event);"/> 
        </apex:column>

 



Message Edited by meyerd on 10-17-2008 07:17 AM
  • October 17, 2008
  • Like
  • 0
I am trying to display the Partners related list

Code:
<apex:page standardController="Opportunity">
<apex:outputText value="{!Opportunity.Name}"/>

<!--<apex:relatedList list="OpenActivities"/>-->
<apex:relatedList list="Partners"/>
</apex:page>

 
I get a Visual Force error:
'Partners' is not a valid child relationship name for entity Opportunity.

Under Opportunity child Relationship I see the relationship name is 'Partners'









  • April 16, 2008
  • Like
  • 0
I am finding the following when trying to update an ajax aware output panel.
If the required field has a value then all is good. If I blank the value of the required input field in the ui and submit the panel it does not get updated and I get no indication that anything has happened.
In the apex log I see


<apex:inputField> value '{!Opportunity.Name}' is required
***Ending Page Log for /apex/PanelTst

vf page

Code:
<apex:page controller="tstController">
<apex:form id="mainForm" >
<apex:sectionHeader title="{!Opportunity.Name}"/>

<apex:pageBlock id="mainPb">
<apex:pageBlockSection title="Opportunity Details" columns="2">
<apex:inputField value="{!Opportunity.Name}" required="true"/>
</apex:pageBlockSection>

<br/>
<apex:outputPanel>
<apex:outputPanel id="MyOutputPanelId">
<apex:inputText id="InputTextPanelId" value="{!TextFieldInPanel}"/>
</apex:outputPanel>
</apex:outputPanel>

<br/>
<apex:commandButton value="Submit Panel" rerender="MyOutputPanelId"/>
</apex:pageBlock>
</apex:form>


</apex:page>

 controller
Code:
public class tstController {

private Final String oid = System.currentPageReference().getParameters().get('id');

Opportunity o;
public Opportunity getOpportunity() {
o = [select Name, CloseDate from Opportunity where Id = :oid];
return o;
}

Private String panelText='Y';

public String getTextFieldInPanel() { return panelText; }
public void setTextFieldInPanel(String data) { panelText = data +'X';}


}

 

  • February 20, 2008
  • Like
  • 0
Set PriceBookEntry.Name of Opportunity Line Item for display in VF page.

I am using a datatable to show a list of Opportunities. I initially query for and display directly from sfdc.

Code:
public List<OpportunityLineItem> getLineItemsTechnology() {
if(lit == null){
lit = [select PriceBookEntry.Name, Mix__c, Quantity, UnitPrice, PriceBookEntry.ProductCode
from OpportunityLineItem where OpportunityId = :oid and PriceBookEntry.ProductCode = 'Technology'];
}

return lit;
}

 


I have another method that adds to lit and re-renders that section.
I want to set PriceBookEntry.Name for display in the VF page

Something like

Code:
OpportunityLineItem tmpOLI = [select Mix__c,PriceBookEntry.Name from OpportunityLineItem limit 1];
OpportunityLineItem newOLI = tmpOLI.clone(false);

newOLI.PriceBookEntry.Name = 'Set Name For Display in VF Page Datatable';

 
I can execute/save the code that sets the PriceBookEntry.Name through eclipse using v10 of the Api.
However through the UI [saving apex code or saving from the vf controller editor] I get the message.

Error: Compile Error: Field is not writeable: PricebookEntry.Name at line 54 column 17.


  • January 02, 2008
  • Like
  • 0
Validation rule message not shown on Visual Force page.

For example I created a validation rule on opportunity

LEN(Name) > 10

I have the following VF page.

Code:
<apex:page StandardController="opportunity" tabstyle="opportunity">
<apex:form>
        <apex:inputField value="{!Opportunity.Name}"/>
        <br/>
        <apex:inputField value="{!Opportunity.CloseDate}"/>
        <br/>
        <apex:inputField value="{!Opportunity.StageName}"/>
        <br/>
        <apex:commandButton action="{!save}" value="Save"/>
        <apex:commandButton action="{!cancel}" value="Cancel"/>
</apex:form>
</apex:page>

 
This is the behavior

I edit/create an opportunity with a name < 10 chars and the oppty save works.
I edit/create an opportunity with a name > 10 chars and the oppty does not save and I see the validation rule message.

I override edit for Opportunity with this vf page.
If I edit an opportunity and use the vf page with name < 10, save works fine.
If I edit an opportunity using the vf page and put in a name > 10 chars, it does not save but also does not show the Validation rule error message.

What do I need to do to get the validation rule message to show?






  • December 20, 2007
  • Like
  • 0

The following code works in Apex Rest enabled sandbox.

However after deploying the same code to production it returns

 

[ {
  "message" : "Could not find a match for URL /MyTask",
  "errorCode" : "NOT_FOUND"
} ]

 

@RestResource(urlMapping='/MyTask/*')
global with sharing class TaskResource {
    @HttpGet
    global static Task[] doGet(RestRequest req, RestResponse res){
        Task[] result = [Select  Id, Subject, Status, ActivityDate, Priority, Description, WhatId, What.Name
                  From Task
                   where Status <> 'Completed' and ownerid = :UserInfo.getUserId() order by activitydate];
        return result;
    }
}

 

/salesforce.com/services/apexrest/MyTask

 

 

Suggestions?

 

 

Any way to serve manifest files from SFDC, static resource, vf page, other with mime type 'text/cache-manifest'?

  • August 09, 2010
  • Like
  • 0
  • Starting with a picklist that is sorted alpha  “ Sort values alphabetically, not in the order entered.”
  • V19 of the metadata wsdl

1)      add a value through the metadata api.

2)      add a value through the metadata api and setSorted(true); to the pl in the code.

 

In both 1) and 2) this value shows as the first value even though by alpha it would not be. Suggestions?

 

 

System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ");
long waitTimeMilliSecs = 1000;

String objectName = "MyObject__c";
String fieldName = "MyPickListField__c";
String fieldLabel = "MyPickListField";

HashSet<String> ValuesToProcess = new HashSet<String>();

ValuesToProcess.add("NewPickListValue");

CustomField field = new CustomField();
field.setFullName(objectName + "." + fieldName);

field.setType(FieldType.Picklist);

field.setLabel(fieldLabel);
Picklist PicklistToManipulate = new Picklist();

PicklistValue tmpPicklistValue = new PicklistValue();
String toAdd;
Integer i = 0;

Iterator<String> processIterator = ValuesToProcess.iterator();
PicklistValue[] allPicklistValues = new PicklistValue[ValuesToProcess.size()];

while (processIterator.hasNext()) {
	toAdd = processIterator.next();
	System.out.println("to add " + toAdd);
	tmpPicklistValue = new PicklistValue();
	tmpPicklistValue.setFullName(toAdd);
	allPicklistValues[i++] = tmpPicklistValue;
}
PicklistToManipulate.setPicklistValues(allPicklistValues);

//setSorted?
System.out.println("setSorted(true)");
PicklistToManipulate.setSorted(true);		

field.setPicklist(PicklistToManipulate);


UpdateMetadata updateMetadata = new UpdateMetadata();
updateMetadata.setMetadata(field);
updateMetadata.setCurrentName(objectName + "." + fieldName);

AsyncResult[] ars;
try {
	ars = metadatabinding.update(new UpdateMetadata[] { updateMetadata });

	AsyncResult asyncResult = ars[0];
	while (!asyncResult.isDone()) {
		Thread.sleep(waitTimeMilliSecs);
		// double the wait time for the next iteration
		waitTimeMilliSecs *= 2;
		asyncResult = metadatabinding.checkStatus(new String[] { asyncResult.getId() })[0];
		System.out.println("Status is: " + asyncResult.getState());
	}
	if (asyncResult.getState() != AsyncRequestState.Completed) {
		throw new Exception(asyncResult.getStatusCode() + " msg: " + asyncResult.getMessage());
	}

} catch (Exception e) {
	e.printStackTrace();
}

 

 

Hi..

Need some help here...Im using API to insert Task. But every time I create task using API the email notification will not be send to the Owner of the TASK. Even I set send email notification as default in UI, when I try to load using API its still not work...

 

Appreciate if anyone can give me an advise or guideline regarding this issue.

 

Thank you in advance!

Message Edited by Ninie on 07-09-2009 02:34 AM
  • July 09, 2009
  • Like
  • 0
I have a visual force page that gets select options from a controller.
I have required="true" for the selectList.
No red bar shows on the page when it is displayed.
If I don't select a value and submit the form.
I do not get a message on the field 'You must enter a value' like I do on other fields required in the same way, but do get informed in  apex:pageMessages mentioning

thePage:theForm:j_id1:j_id5:0: Validation Error: Value is required.

The field is a multiselect picklist which I am showing on the VF page as a selectList size 1 only when the user has not previously selected values for that field.

Code:
<apex:page standardController="Opportunity" recordSetVar="opportunities" sidebar="false" showHeader="true" extensions="OpptyMultiEdit_CTE" id="thePage">
......
<apex:pageBlockTable value="{!OpptyList}" var="oppty" cellpadding="4" headerClass="TH_Class">
......
<apex:selectList required="true" size="1" value="{!oppty.Competitors__c}">
<apex:selectOptions value="{!CompetitorsPicklist}"/>
</apex:selectList>



Opportunity[] Opptys;
public List<Opportunity> getOpptyList()
{
return Opptys;
}

public List<SelectOption> getCompetitorsPicklist()
{
List<SelectOption> options = new List<SelectOption>();
Schema.DescribeFieldResult f = Opportunity.Competitors__c.getDescribe();
String defValue = '';
options.add( new SelectOption( '', '--None--'));
for(Schema.PicklistEntry pe : f.getPicklistValues())
{
if ( pe.getValue() != Competitors )
{
options.add( new SelectOption( pe.getValue(), pe.getLabel() ));
}
}
return options;
}

Ideas on
-why the red bar not showing?
-why is the field not being Highlighted and marked with 'Error: You must enter a value' when I submit the form?





  • December 08, 2008
  • Like
  • 0
I have a field which shows the translated labels based on the users language.

In a Visual Force page I see how to show the translated label for an output field.
How would I show the translated label as the column header for an input field which has an onchange event?

    <apex:pageBlockTable value="{!OpptyList}" var="oppty" cellpadding="4">
        <apex:column headerValue="Stage"> 
            <apex:inputField value="{!oppty.stageName}" id="OPPTY_STAGE" onchange="changeFcstStatus(event);"/> 
        </apex:column>

 



Message Edited by meyerd on 10-17-2008 07:17 AM
  • October 17, 2008
  • Like
  • 0
I am trying to display the Partners related list

Code:
<apex:page standardController="Opportunity">
<apex:outputText value="{!Opportunity.Name}"/>

<!--<apex:relatedList list="OpenActivities"/>-->
<apex:relatedList list="Partners"/>
</apex:page>

 
I get a Visual Force error:
'Partners' is not a valid child relationship name for entity Opportunity.

Under Opportunity child Relationship I see the relationship name is 'Partners'









  • April 16, 2008
  • Like
  • 0
I am finding the following when trying to update an ajax aware output panel.
If the required field has a value then all is good. If I blank the value of the required input field in the ui and submit the panel it does not get updated and I get no indication that anything has happened.
In the apex log I see


<apex:inputField> value '{!Opportunity.Name}' is required
***Ending Page Log for /apex/PanelTst

vf page

Code:
<apex:page controller="tstController">
<apex:form id="mainForm" >
<apex:sectionHeader title="{!Opportunity.Name}"/>

<apex:pageBlock id="mainPb">
<apex:pageBlockSection title="Opportunity Details" columns="2">
<apex:inputField value="{!Opportunity.Name}" required="true"/>
</apex:pageBlockSection>

<br/>
<apex:outputPanel>
<apex:outputPanel id="MyOutputPanelId">
<apex:inputText id="InputTextPanelId" value="{!TextFieldInPanel}"/>
</apex:outputPanel>
</apex:outputPanel>

<br/>
<apex:commandButton value="Submit Panel" rerender="MyOutputPanelId"/>
</apex:pageBlock>
</apex:form>


</apex:page>

 controller
Code:
public class tstController {

private Final String oid = System.currentPageReference().getParameters().get('id');

Opportunity o;
public Opportunity getOpportunity() {
o = [select Name, CloseDate from Opportunity where Id = :oid];
return o;
}

Private String panelText='Y';

public String getTextFieldInPanel() { return panelText; }
public void setTextFieldInPanel(String data) { panelText = data +'X';}


}

 

  • February 20, 2008
  • Like
  • 0
Set PriceBookEntry.Name of Opportunity Line Item for display in VF page.

I am using a datatable to show a list of Opportunities. I initially query for and display directly from sfdc.

Code:
public List<OpportunityLineItem> getLineItemsTechnology() {
if(lit == null){
lit = [select PriceBookEntry.Name, Mix__c, Quantity, UnitPrice, PriceBookEntry.ProductCode
from OpportunityLineItem where OpportunityId = :oid and PriceBookEntry.ProductCode = 'Technology'];
}

return lit;
}

 


I have another method that adds to lit and re-renders that section.
I want to set PriceBookEntry.Name for display in the VF page

Something like

Code:
OpportunityLineItem tmpOLI = [select Mix__c,PriceBookEntry.Name from OpportunityLineItem limit 1];
OpportunityLineItem newOLI = tmpOLI.clone(false);

newOLI.PriceBookEntry.Name = 'Set Name For Display in VF Page Datatable';

 
I can execute/save the code that sets the PriceBookEntry.Name through eclipse using v10 of the Api.
However through the UI [saving apex code or saving from the vf controller editor] I get the message.

Error: Compile Error: Field is not writeable: PricebookEntry.Name at line 54 column 17.


  • January 02, 2008
  • Like
  • 0