• Behzad
  • NEWBIE
  • 110 Points
  • Member since 2009

  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 8
    Replies

Hey guys,

 

I have a JavaScript List Button that I'm using on a Related List.

 

Users are to select a number of records from the serviceVendorPartnership Related List, and click on Disable button that automatically changes the branchType__c picklist field to "None" for selected records. 

 

I know that I have to update a list of records, and I'm using an update connection method to update all records in the list, as highlighted in my code below:

 

{!REQUIRESCRIPT("/soap/ajax/16.0/connection.js")} 
records = {!GETRECORDIDS($ObjectType.serviceVendorPartnership__c)};

var newRecords = [records];

//Making Sure user has selected at least one row
if(records.length<1) {
alert("Please choose at least one Service Vendor Location to disable.");
} else {

//Confirming user's action
var r = confirm("Click ''OK'' to disable selected Service Vendor Locations.");
if (r == true) {
try {

records.branchType__c = 'None';
result = sforce.connection.update([newRecords]);
window.location.reload();

if (result[0].getBoolean("success")) {
alert("Service Vendor Location with id " + result[0].id + " updated");
} else {
alert("failed to update Service Vendor Location" + result[0]);
}
}
catch (e) {
alert(e);
}
}

 

 

My button is throwing the following error message:

failed to update Service Vendor Location{errors:{message:'sObject type 'sObject' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.', statusCode:'INVALID_TYPE', }, id:null, success:'false', }

 

Does anyone know why the id list is returning null?

 

I greatly appreciate your feedbacks.

 

Thank you,

 

Behzad

Hey all,

 

I got a wrapper that I use for multiselection. I previously used its code in a component controller, but now I want to use it in a constructor extentsion.

 

Here is the code that I got:

 

public with sharing class partnershipDeactivatorController {

public program__c prog {get;set;}
public distributionPartnership__c dp {get;set;}
public Terminal__c trm {get;set;}
public Location__c [] locs = new Location__c[0];
public Terminal__c [] trms = new Terminal__c[0];


public distributionPartnership__c [] dps = new distributionPartnership__c[0];
public List<String> recordIds {get;set;}


public string progId {get;set;}
public string retUrl {get;set;}
public string idsToSplit {get;set;}
public string schedule {get;set;}
public string cmd {get;set;}

//Variables for multiselector on Deactivation Partnerhisp Page
public boolean topCheckbox {get; set;}
List<rcrdWrapper> rcrdList {get;set;}

//Constructor
public ApexPages.StandardController controller;
public partnershipDeactivatorController(ApexPages.StandardController controller) {
this.controller = controller;
//make it easy to map page params
PageReference pageRef = ApexPages.CurrentPage();
Map<String, String> page = pageRef.getParameters();

dp = (distributionPartnership__c) controller.getrecord();
Terminal__c trm = new Terminal__c();

progId = page.get('progId');
retUrl = page.get('retUrl');

if (progId != null) {
prog = getProg();
dp.Program__c = prog.id;
}

string s = page.get('records');
this.idsToSplit = s;
this.recordIds = this.idsToSplit.split(',',0);

}

//Get the locations from the list of ids specified
public Terminal__c[] getTrms(){
Trms = [
SELECT
id,
distributionPartnership__c,
Type__c,
Location__c
FROM Terminal__c
WHERE distributionPartnership__c IN :recordIds
];
return Trms;
}

//Get the program
public program__c getProg(){
prog = [select
id,
group__c
from program__c
where id = :progId
limit 1
];
return prog;
}
public void cmdBtn(){
}

//{!rcrds} is the pageBlockTable value to render
public List<rcrdWrapper> rcrds
{
get
{
if (rcrdList == null)
{
rcrdList = new List<rcrdWrapper>();
Terminal__c[] trms = [
SELECT
id,
distributionPartnership__c,
Type__c,
Location__c
FROM Terminal__c
WHERE distributionPartnership__c IN :recordIds
];

for(Terminal__c trm : trms)
rcrdList.add(new rcrdWrapper(trm));

}
return rcrdList;
}
}

private List<rcrdWrapper> selectedRows
{
get
{
List<rcrdWrapper> selectedRows = new List<rcrdWrapper>();

for(rcrdWrapper row : rcrds)
if(row.selected == true)
selectedRows.add(row);

return selectedRows;
}
}

public class rcrdWrapper
{
public distributionPartnership__c rcrd{get; set;}
public Boolean selected {get; set;}

public rcrdWrapper(distributionPartnership__c dp)
{
rcrd = dp;
selected = false;
}
}
}

 

 

The highlighted codes is givving me the following error:

 

Save error: Constructor not defined:
 [partnershipDeactivatorController.rcrdWrapper].<Constructor>(SOBJECT:Terminal__c)

 

I understand this error code, but I don't know how to define the recordWrapper in my constructor.

 

Your help is greatly appreciated.

 

Thanks,

 

Behzad

Hey guys,

 

We have a new user who has access to case records and all of the field on the case object.

We just generated her a log-in access and she also has access to the reports object, and she's able to run and view reports.

However, when she runs a report she's not able to see all of the records in that report, and she can only see few records.

 

All of the hidden records were created before she had access to Salesforce, so I'm wondering if there is a profile setting that I need to enable so she can see all of the records.

 

Please provide any sort of thoughts here.

 

Thank you,

 

  • April 15, 2010
  • Like
  • 0

Hey guys,

 

I'm trying to add a number of days calculation in my Visualforce page, and this calculation is basically counting the number of days left to the end of a process.

 

I'm working with a date/time field, axns.Finish_date_time__c, so I use the ROUND() function to calculate the number of days only.

 

Here is the formula that I use to calculate the number of days left for my process:

 

ROUND(axns.Finish_date_time__c-DATEVALUE(NOW()),0)

 

This formula works well, but for some reason when it is equal to 10 days it shows the number in the following manner: 1E+1

 

 

Is there a way to display this number as 10?

 

 

Thank you,

 

Behzad

  • March 17, 2010
  • Like
  • 0

Hey guys,

 

I've created a Visualforce page for a number of users.

Some of my Org users use IE and some use Firefox.

 

For some reason, my Visualforce page is displayed differently in each web browser.

 

This is a sample of my Visualforce code:

<apex:pageBlock title="IMAC Detail" id="detailPageBlock"> <apex:panelGrid columns="4" rules="rows" styleClass="panelGridClass" title="IMAC detail" width="100%" columnClasses="panelGridLabel, panelGridValue"> <apex:outputText value="IMAC" /> <apex:panelGroup > <apex:outputField value="{!IMAC__c.Name}" rendered=" {!IMAC__c.ID != inlineEditId}"/> <apex:inputField value="{!IMAC__c.Name}" rendered=" {!IMAC__c.Id == inlineEditId}"/> </apex:panelGroup> <apex:outputText value="Owner" /> .... </apex:panelGrid> </apex:pageBlock>

 Also, the following figure highlights the differences between displayed pages in IE and in FireFox:

 IE vs. Firefox


Does anyone know what I need to do so my Visualforce page would render consistenlty accross these web browsers?

 

Thank you,

 

Behzad

 

  • March 10, 2010
  • Like
  • 0

Hey guys,

 

I'm trying to use HelpTitle and HelpUrl in my pageBlocks to point to specific Headers on a WikiPedia page.

I specify particular Urls that should point to a header, but when I click on the help links it just takes me to the page instead of the header.

 

For example, the following help url should take me to the All Details header, but it just takes me to the Detail page instead

 

<apex:pageBlock title="Detail"
helpTitle="Detail Help"
helpUrl="https://www.THEWIKI.com/index.php?title=Detail#All_Details"
id="detailPageBlock">
</apex:pageBlock>

 It results in the following URL:

 

https://www.THEWIKI.com/index.php?title=Detail%23All_Details&showSplash=true

 

The above throws me to the Detail page, and not the All Detail header on that page.

 

How should I change it so it properly points to the All Detail header?

 

 

 

 

Your help is greatly appreciated.

 

Thank you and happy new year,

 

Behzad

  • January 03, 2010
  • Like
  • 0

Hey all,

 

My organization sends emails from Cases to different vendors, then vendors open tickets for the issues and respond to the emails with new ticket numbers.

 

There is a custom filed on the Cases object, called Vendor Reference ID, that is designed to be used for logging the new ticket numbers.

 

Currently, my case teams manually copy the ticket numbers from their emails and update the corresponding Cases in Salesforce.

 

I thought that I can use the Email-to-Case functionality to streamline this process, but I believe this functionality is commonly used for creating cases and not updating the existing ones.

 

So, my question is:

How can I automatically update the Vendor Reference ID field on Cases when vendors respond to the emails that were sent from Cases?

 

I appreciate your thoughts.

 

Thank you and happy new year,

 

Behzad

Message Edited by Behzad on 01-04-2010 10:52 AM
  • December 31, 2010
  • Like
  • 0

Hey guys,

 

I'm trying to use HelpTitle and HelpUrl in my pageBlocks to point to specific Headers on a WikiPedia page.

I specify particular Urls that should point to a header, but when I click on the help links it just takes me to the page instead of the header.

 

For example, the following help url should take me to the All Details header, but it just takes me to the Detail page instead

 

<apex:pageBlock title="Detail"
helpTitle="Detail Help"
helpUrl="https://www.THEWIKI.com/index.php?title=Detail#All_Details"
id="detailPageBlock">
</apex:pageBlock>

 It results in the following URL:

 

https://www.THEWIKI.com/index.php?title=Detail%23All_Details&showSplash=true

 

The above throws me to the Detail page, and not the All Detail header on that page.

 

How should I change it so it properly points to the All Detail header?

 

 

 

 

Your help is greatly appreciated.

 

Thank you and happy new year,

 

Behzad

  • December 31, 2010
  • Like
  • 0

Hey guys,

 

In the case object, I store a number of lookup fields that they all have parent-child relationships. I'm trying to build a Custom Link which gets the parent lookup fields with OnClick JavaScript. I tend to use the Execute JavaScript behavior for my Custom Link. In my JavaScript code, I use a query function to retreive the parent object base on my criteria. The code is as follows:

{!REQUIRESCRIPT("/soap/ajax/16.0/connection.js")} var newRecords = []; var C = new sforce.SObject("Case"); //Parent-Child Object Relationship is as follow: Terminal>>Part var PartParentTerminal = sforce.connection.query("SELECT Terminal__c FROM Part__c WHERE Part__c.Id= '{!Case.PartId__c}' "); //Updating parents via the PART association C.id ="{!Case.Id}"; C.Terminal__c = PartParentTerminal; newRecords.push(C); result = sforce.connection.update(newRecords); window.location.reload();

 This custom link results in the following error code:

 

{faultcode:'soapenv:Client', faultstring:'Unexpected element {urn:partner.soap.sforce.com}done during simple type deserialization', }

 I don't understand the error code and the reasons behind it.

 

I appreciate your thoughts about this issue.

 

Thank you,

 

Behzad

 

 

 

  • October 27, 2009
  • Like
  • 0

Hey guys,

 

I'm trying to create and locate a button or link in one of my object's layout. The custom object that I', working with here is the Terminal object. I would like to call this button the Confirmation.

 

By clicking on this button, users will be prompted with the same record page in edit mode. Also, by clicking on this button, a value from one of the custom fields is cut and pasted into another custom field.

 

Value of the Allocated field is cut and pasted into the location field. These custom fields have the following record id:

 

Allocated field = CF00N80000003dV5a

Location field = CF00N80000002TfbH

 

 

 

The following summarizes the details for my custom button:

 

Label: Confirmation Object Name: Terminal

Name: Confirmation Link Encoding: Unicode (UTF-8)

Behavior: Display in new window Display Type: Detail Page link

 

Moreover, this button has the following URL formula:

"/{!Terminal__c.Id}/e?CF00N80000002TfbH={!Terminal__c.Allocated__c}&CF00N80000003dV5a=&retURL=%2F{!Terminal__c.Id}"

 

 

This button with the above settings works fine and is able to display the record page in an edit mode in a new window.

However, when I try to display this page in an existing window, it would give me an error and it is not able to locate the correct URL. I have the same problem with some of my other buttons where I'm able to prompt my destination page in a new window, but I'm not able to do the same thing in the existing window.

 

Your thoughts and contribution are greatly appreciated.

 

Thanks,

 

Behzad Shahbaz

TIO Networks Corporation

 

Message Edited by Behzad on 09-09-2009 04:20 PM
  • September 09, 2009
  • Like
  • 0

Hey all,

 

I'm trying to uncheck the active check box for a number of locations object records.

 

The setup of my objects is as follow:

 

Locations --> Hardware (Both are custom objects which have parent child relationship)

 

I have a related list of Hardware for every Location record.

And, location records have an Active check box status which identifies if that location is currently active or not.

 

The logic behind the Active check box:

It is assumed to be unchecked if there are no Hardware records in the respective Locations related list.

And, it is assumed to be checked if there is one or more Hardware records in the respective Locations related list.

 

I believe this is viable through the Triggers.

 

Any help or comment is appreciated.

 

Thank you,

 

Behzad

 

Hey all,

 

I wanted to update a field in a custom object using Visualforce.

 

The custom object that I am working on is called "Parts". And, the field that I'm looking to update in this custom object is called "Part Name."

 

The field "Part Name" is consisted of two fields "Part Model Name" and "Location Address." The "Part Model Name" is a field in the Parts object which stores the part model. The "Location Address" is a field in the Location obejct which stores location address.The Parts custom object looks up to a Location custom object- has a child relationship with the Location object.

 

Custom Object Relationship:

Location (Has a field called Location Address) --> Part (Has a field called Part Model Name)

 

Part Name Field in the Parts Object to be updated:

Part Name = Part Model Name @ Location Address

 

I currently use an extra field in the part object to grab the location address information, and I currently update the Part Name field via a Field update. However, I would like to get rid of that extra field and perform the field update through a Visualforce.

 

I don't have sufficient Visualforce knowledge to do this. Any help or comment is greatly appreciated.

 

Thanks,

Hey guys,

 

I have a JavaScript List Button that I'm using on a Related List.

 

Users are to select a number of records from the serviceVendorPartnership Related List, and click on Disable button that automatically changes the branchType__c picklist field to "None" for selected records. 

 

I know that I have to update a list of records, and I'm using an update connection method to update all records in the list, as highlighted in my code below:

 

{!REQUIRESCRIPT("/soap/ajax/16.0/connection.js")} 
records = {!GETRECORDIDS($ObjectType.serviceVendorPartnership__c)};

var newRecords = [records];

//Making Sure user has selected at least one row
if(records.length<1) {
alert("Please choose at least one Service Vendor Location to disable.");
} else {

//Confirming user's action
var r = confirm("Click ''OK'' to disable selected Service Vendor Locations.");
if (r == true) {
try {

records.branchType__c = 'None';
result = sforce.connection.update([newRecords]);
window.location.reload();

if (result[0].getBoolean("success")) {
alert("Service Vendor Location with id " + result[0].id + " updated");
} else {
alert("failed to update Service Vendor Location" + result[0]);
}
}
catch (e) {
alert(e);
}
}

 

 

My button is throwing the following error message:

failed to update Service Vendor Location{errors:{message:'sObject type 'sObject' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.', statusCode:'INVALID_TYPE', }, id:null, success:'false', }

 

Does anyone know why the id list is returning null?

 

I greatly appreciate your feedbacks.

 

Thank you,

 

Behzad

Hey all,

 

I got a wrapper that I use for multiselection. I previously used its code in a component controller, but now I want to use it in a constructor extentsion.

 

Here is the code that I got:

 

public with sharing class partnershipDeactivatorController {

public program__c prog {get;set;}
public distributionPartnership__c dp {get;set;}
public Terminal__c trm {get;set;}
public Location__c [] locs = new Location__c[0];
public Terminal__c [] trms = new Terminal__c[0];


public distributionPartnership__c [] dps = new distributionPartnership__c[0];
public List<String> recordIds {get;set;}


public string progId {get;set;}
public string retUrl {get;set;}
public string idsToSplit {get;set;}
public string schedule {get;set;}
public string cmd {get;set;}

//Variables for multiselector on Deactivation Partnerhisp Page
public boolean topCheckbox {get; set;}
List<rcrdWrapper> rcrdList {get;set;}

//Constructor
public ApexPages.StandardController controller;
public partnershipDeactivatorController(ApexPages.StandardController controller) {
this.controller = controller;
//make it easy to map page params
PageReference pageRef = ApexPages.CurrentPage();
Map<String, String> page = pageRef.getParameters();

dp = (distributionPartnership__c) controller.getrecord();
Terminal__c trm = new Terminal__c();

progId = page.get('progId');
retUrl = page.get('retUrl');

if (progId != null) {
prog = getProg();
dp.Program__c = prog.id;
}

string s = page.get('records');
this.idsToSplit = s;
this.recordIds = this.idsToSplit.split(',',0);

}

//Get the locations from the list of ids specified
public Terminal__c[] getTrms(){
Trms = [
SELECT
id,
distributionPartnership__c,
Type__c,
Location__c
FROM Terminal__c
WHERE distributionPartnership__c IN :recordIds
];
return Trms;
}

//Get the program
public program__c getProg(){
prog = [select
id,
group__c
from program__c
where id = :progId
limit 1
];
return prog;
}
public void cmdBtn(){
}

//{!rcrds} is the pageBlockTable value to render
public List<rcrdWrapper> rcrds
{
get
{
if (rcrdList == null)
{
rcrdList = new List<rcrdWrapper>();
Terminal__c[] trms = [
SELECT
id,
distributionPartnership__c,
Type__c,
Location__c
FROM Terminal__c
WHERE distributionPartnership__c IN :recordIds
];

for(Terminal__c trm : trms)
rcrdList.add(new rcrdWrapper(trm));

}
return rcrdList;
}
}

private List<rcrdWrapper> selectedRows
{
get
{
List<rcrdWrapper> selectedRows = new List<rcrdWrapper>();

for(rcrdWrapper row : rcrds)
if(row.selected == true)
selectedRows.add(row);

return selectedRows;
}
}

public class rcrdWrapper
{
public distributionPartnership__c rcrd{get; set;}
public Boolean selected {get; set;}

public rcrdWrapper(distributionPartnership__c dp)
{
rcrd = dp;
selected = false;
}
}
}

 

 

The highlighted codes is givving me the following error:

 

Save error: Constructor not defined:
 [partnershipDeactivatorController.rcrdWrapper].<Constructor>(SOBJECT:Terminal__c)

 

I understand this error code, but I don't know how to define the recordWrapper in my constructor.

 

Your help is greatly appreciated.

 

Thanks,

 

Behzad

Hey guys,

 

I'm trying to add a number of days calculation in my Visualforce page, and this calculation is basically counting the number of days left to the end of a process.

 

I'm working with a date/time field, axns.Finish_date_time__c, so I use the ROUND() function to calculate the number of days only.

 

Here is the formula that I use to calculate the number of days left for my process:

 

ROUND(axns.Finish_date_time__c-DATEVALUE(NOW()),0)

 

This formula works well, but for some reason when it is equal to 10 days it shows the number in the following manner: 1E+1

 

 

Is there a way to display this number as 10?

 

 

Thank you,

 

Behzad

  • March 17, 2010
  • Like
  • 0

Hey guys,

 

I've created a Visualforce page for a number of users.

Some of my Org users use IE and some use Firefox.

 

For some reason, my Visualforce page is displayed differently in each web browser.

 

This is a sample of my Visualforce code:

<apex:pageBlock title="IMAC Detail" id="detailPageBlock"> <apex:panelGrid columns="4" rules="rows" styleClass="panelGridClass" title="IMAC detail" width="100%" columnClasses="panelGridLabel, panelGridValue"> <apex:outputText value="IMAC" /> <apex:panelGroup > <apex:outputField value="{!IMAC__c.Name}" rendered=" {!IMAC__c.ID != inlineEditId}"/> <apex:inputField value="{!IMAC__c.Name}" rendered=" {!IMAC__c.Id == inlineEditId}"/> </apex:panelGroup> <apex:outputText value="Owner" /> .... </apex:panelGrid> </apex:pageBlock>

 Also, the following figure highlights the differences between displayed pages in IE and in FireFox:

 IE vs. Firefox


Does anyone know what I need to do so my Visualforce page would render consistenlty accross these web browsers?

 

Thank you,

 

Behzad

 

  • March 10, 2010
  • Like
  • 0

Hey guys,

 

I'm trying to use HelpTitle and HelpUrl in my pageBlocks to point to specific Headers on a WikiPedia page.

I specify particular Urls that should point to a header, but when I click on the help links it just takes me to the page instead of the header.

 

For example, the following help url should take me to the All Details header, but it just takes me to the Detail page instead

 

<apex:pageBlock title="Detail"
helpTitle="Detail Help"
helpUrl="https://www.THEWIKI.com/index.php?title=Detail#All_Details"
id="detailPageBlock">
</apex:pageBlock>

 It results in the following URL:

 

https://www.THEWIKI.com/index.php?title=Detail%23All_Details&showSplash=true

 

The above throws me to the Detail page, and not the All Detail header on that page.

 

How should I change it so it properly points to the All Detail header?

 

 

 

 

Your help is greatly appreciated.

 

Thank you and happy new year,

 

Behzad

  • December 31, 2010
  • Like
  • 0

Hey guys,

 

In the case object, I store a number of lookup fields that they all have parent-child relationships. I'm trying to build a Custom Link which gets the parent lookup fields with OnClick JavaScript. I tend to use the Execute JavaScript behavior for my Custom Link. In my JavaScript code, I use a query function to retreive the parent object base on my criteria. The code is as follows:

{!REQUIRESCRIPT("/soap/ajax/16.0/connection.js")} var newRecords = []; var C = new sforce.SObject("Case"); //Parent-Child Object Relationship is as follow: Terminal>>Part var PartParentTerminal = sforce.connection.query("SELECT Terminal__c FROM Part__c WHERE Part__c.Id= '{!Case.PartId__c}' "); //Updating parents via the PART association C.id ="{!Case.Id}"; C.Terminal__c = PartParentTerminal; newRecords.push(C); result = sforce.connection.update(newRecords); window.location.reload();

 This custom link results in the following error code:

 

{faultcode:'soapenv:Client', faultstring:'Unexpected element {urn:partner.soap.sforce.com}done during simple type deserialization', }

 I don't understand the error code and the reasons behind it.

 

I appreciate your thoughts about this issue.

 

Thank you,

 

Behzad

 

 

 

  • October 27, 2009
  • Like
  • 0

Hey all,

 

I wanted to update a field in a custom object using Visualforce.

 

The custom object that I am working on is called "Parts". And, the field that I'm looking to update in this custom object is called "Part Name."

 

The field "Part Name" is consisted of two fields "Part Model Name" and "Location Address." The "Part Model Name" is a field in the Parts object which stores the part model. The "Location Address" is a field in the Location obejct which stores location address.The Parts custom object looks up to a Location custom object- has a child relationship with the Location object.

 

Custom Object Relationship:

Location (Has a field called Location Address) --> Part (Has a field called Part Model Name)

 

Part Name Field in the Parts Object to be updated:

Part Name = Part Model Name @ Location Address

 

I currently use an extra field in the part object to grab the location address information, and I currently update the Part Name field via a Field update. However, I would like to get rid of that extra field and perform the field update through a Visualforce.

 

I don't have sufficient Visualforce knowledge to do this. Any help or comment is greatly appreciated.

 

Thanks,