• Siddharth
  • NEWBIE
  • 25 Points
  • Member since 2005

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 36
    Questions
  • 21
    Replies

I have a page which queries to data from a customer table. This is then displayed in a pageblocktable in a pageblock with many row.

 

I want to have (if possible) a pageblock that will display the details of a record based on a record being selected 'onclick' but I can't seem to figure out how to rerender the pageblock based on clicking an item in the pageblocktable. I have tried using the actionSupport but this doesn't see to work inside the pageblocktable?

 

Any help is appreciated.

I have a before trigger that calls this class which auto assigns the region and the ownerid to the account based on the recordtype, state and zip of the region object. the region object holds all the assignments. It works great but when I execute a batch load through data laoder I hit too many script statements 200001 error. any way i can fix?

 

 

public with sharing class AccountUtilities
{
public static void acctAssign(List<Account> aList)
{
List<region__c> rList = [select id, zip_start__c, zip_end__c, state__c,sales_user__c, business_unit__c, recordTypeId from region__c];
Map<Id,RecordType> rtMap = new Map<Id,RecordType>([Select id,Name from RecordType where sObjectType IN ('Account','region__c')]);
for(Account a:aList)
{
try
{
for(integer i= 0; i< rList.size(); i++)
{
String billingPostalCode= String.valueOf(a.BillingPostalCode);
if(a.billingstate== rList.get(i).state__c && a.Protected__c != true && rtMap.get(a.recordtypeid).Name == rtMap.get(rList.get(i).recordtypeid).Name && a.business_unit__c == tList.get(i).business_unit__c)
{
if(a.billingPostalCode >= rList.get(i).zip_start__c && a.billingPostalCode<=rList.get(i).zip_end__c || rList.get(i).zip_start__c ==null && rList.get(i).zip_end__c ==null )
{
a.region__c = rList.get(i).id;
a.OwnerId = rList.get(i).sales_user__c;
}
}
}
}
catch (System.Exception e)
{
// process exception
}

}
}



Has anyone created a code for this? We would like to create a new field that returns the last time a lead, or contact, was called. The problem with the "last activity" field is that it includes mass emails which doesn't really help us. Figure we need to use Apex code to query the type of activity etc. and bring back the date of the last phone call. 

Hi,

 

My query "Select l.Owner.ManagerId, l.OwnerId, l.Name From Lead l" is not giving me any results. I have tried using eclipse, SForce explorer and even th debugger, but it returns "No such column 'ManagerId' on entity 'Name'." I am able to access all other fields from the User object.

 

Can someone confirm me if this is a bug or whether this field is not accessible.

 

Thanking you in anticipation

 

Siddharth

We have a managed package which uses FLEX, can some tell me how to set the value for ClientId in Flex in SOAP Header.

 

Thanks

Siddharth

Astadia

Is there a way in salesforce to hide Visualforce Code and SControls when creating a package. I want them to be part of package but should be private and not visible to users.

Thanks
Siddharth
Hello,
 
I have written an apex class which has function called getCampaigns(). This functions executes parameterized queries and returns a wrapper list.
 
On my Visualforce page i have a search panel which filter the campaigns based on Dates and other criterias. When i click on the command button to execute this function in the SystemLog i could see it executing 2-3 times and also it doesnot maintain the new dates in text boxes after postback.
 
Below is a small snippet from the code:
 
private Integer FitlerStatus;
private Integer IsPostBack = 1;
WrapperCalender[] wrapExtn;
public PageReference GetAllData()
{
 MonthSDate = '';
 MonthEDate = '';
 MonthStartDate = null;
 MonthEndDate = null;
 
 this.FitlerStatus = 1;
 IsPostBack = 4;
 wrapExtn = getCampaigns();
 return null;
}
public WrapperCalender[] getCampaigns()
{
 if (IsPostBack == 2 && FitlerStatus == 0)
 {  
  cmpList = [Select c.StartDate,c.EndDate,c.Id, (Select id, Name, Budget_Status__c From CMOExtensions__r) from Campaign c
   where IsActive = true and startdate >=: MonthStartDate and startdate <=: MonthEndDate 
   and startdate != null order by c.StartDate asc];
 }
 else
 {
  if (IsPostBack == 3)
  {      
   cmpList = [Select c.StartDate,c.EndDate,c.Id, (Select id, Name, Budget_Status__c From CMOExtensions__r) from Campaign c
    where IsActive = true and startdate >=: MonthStartDate and enddate <=: MonthEndDate
    and startdate != null order by c.StartDate asc];
      
  }
  if (IsPostBack == 4)
  {   
   cmpList = [Select c.StartDate,c.EndDate,c.Id, (Select id, Name, Budget_Status__c From CMOExtensions__r) from Campaign c
    where IsActive = true and startdate != null order by c.StartDate asc];
  }
 }
 
 wrapExtn = new WrapperCalender[cmpList.size()];
 
 if(cmpList !=null && cmpList.size()>0)
 {
  //
 }
}
 
So now when i access GetAllData() on command button click then all the 3 scenarios gets executed. Can someone prove help or suggestion, that would be appreciated.
 
thanks in advance
Siddharth
Hi

I assume this is simple enough, but don't want to waste time figuring it out.  I'm trying to render the Name of a Record as a link to the Record in a column of a pageBlockTable.

I'm using this syntax currently:

Code:
<apex:column headerValue="Name">
      <apex:outputLink value="{!lead.Id}">{!lead.Name}</apex:outputLink>
</apex:column>

 Supposing I'm on a na2.salesforce.com, this will output the link as https://na2.salesforce.com/apex/00Q4000000HA9xUEAT.  Obviously I don't want the /apex/ in the URL.  I know I want to use the current server as the value in outputLink and the Record ID as a param, but how do I merge in the URL of the current server?

Thanks!
Hi
I use toolbar ,toolbar group , but i got only green color.
How can i change toolbar color. and i also wants links are in white colors.
I attach my code.please give me suggestions & if possible then give me a sample code.
 
 
<apex:toolbar id="theToolbar" styleClass="pbTitle">
               
               
              
                <apex:toolbarGroup itemSeparator="line" location="left" id="toobarGroupForm2">
                              
                              
                              <apex:outputLink value="/apex/DashBoard" id="myPage" target="theIframe" >My Page</apex:outputLink>
                                <apex:outputLink value="/apex/DashBoard1" id="DashBoard1" target="theIframe" >DashBoard1</apex:outputLink>
                                <apex:outputLink value="/apex/Program_Setup" id="Program_Setup"  target="theIframe">Program Setup</apex:outputLink>
                                <apex:outputLink value="/apex/Forecasting" id="Forecasting"  target="theIframe">Forecasting</apex:outputLink>
                                <apex:outputLink value="/apex/Inventory_Management" id="Inventory_Management"  target="theIframe">Inventory Management</apex:outputLink>
                                <apex:outputLink value="/apex/Store_Performance" id="Store_Performance"  target="theIframe">Store Performance</apex:outputLink>
                              
                       
                </apex:toolbarGroup>
  </apex:toolbar>
 
 
 
Thanks & Regards
Brijesh Baser
Hi,
 
I am creating a SOQL query where the field name and the field value in where clause, both comes dynamically. Eg:
 
something like:
 
String fieldname = 'Name';
Account account = [Select Id from Acocunt where :fieldname like 'ABC'];
 
This doesnt works :(
 
Can anyone please advise, how can i get this query?
 
Thanks
[GM]
 
Friends,
 
I have created a simple APEX class with a function named HELLO() which accepts a string, searched in accounts for name starting with that string and returns a count in string format. I have generated it as a Web Method so that I can use this in .Net. I further generated a WSDL file from it and tried to use it ASP.NET.
 
After creating an instance of my web service, i get the Hello method accessible, but how do I set the login credentials for my APEX call. It says invalid session Id. Snippet from ASP.Net code.
 

protected void Page_Load(object sender, EventArgs e)

{

Test.HelloWorld2Service obj = new CellsMerge.Test.HelloWorld2Service();

string a = obj.Hello("s");

}

 

Any suggestions as how can we achieve this functionality.

Siddharth

"2007-10-29T10:38:36.000Z" how to convert this into datetime format for c#
 
amit@varstreet.com
We have created an external .NET app that logs into our SalesForce.com account and retrieves corresponding contact data, which is then used to email out company-specific messages. The app works fine, but now we would like to update our SalesForce.com account with a record of those email postings.
 
Accordingly, it seems like we need to create "completed" tasks that are assigned to each contact that has been emailed. I've written the following test code in .NET just to see if I can create task objects in SalesForce:
 

Dim sForceService As New sforce.SforceService
sForceService.Url = mSessionURL
sForceService.SessionHeaderValue =
New sforce.SessionHeader
sForceService.SessionHeaderValue.sessionId = mSessionID
Dim taskArray(0) As sforce.sObject
Dim sTask As sforce.Task = New sforce.Task
sTask.CreatedById = mUserID
sTask.OwnerId = mRecipientID
sTask.ActivityDate = DateTime.Now
sTask.Description =
"Test Description"
sTask.Priority = "Normal"
sTask.Status = "Completed"
sTask.Subject = "Email: Test Email"
taskArray(0) = sTask
Dim sr() As sforce.SaveResult = sForceService.create(taskArray)

When I try to run the code in Visual Studio's Debug mode, everything seems to work fine until it gets to the very last line above; when the Dim sr() As sforce.SaveResult = sForceService.create(taskArray) code executes, I get the following error: "Unable to automatically step into the server. Connecting to the server machine "na2-api.salesforce.com" failed. The format of the specified network name is invalid."

I've tried researching this error and verifying that what I'm trying to do is valid, but I can't find any answers. Has anyone tried creating their own task objects before? Note that I'm presuming that the same SalesForce server is used to create new objects as well as read existing company data. All help is appreciated.

Hi Community,
 
 I am unable to select ParentId from case using outbound message. In Notification function i am getting 8.0 Server URL which through following exception while executing outbound message: -
"INVALID_FIELD: No such column 'ParentId' on entity 'Case'. If you are attempting to use a custom field, be sure to append the '_"
 
Thanks! I would appreciate any solution or suggestions.
 
 
I am Trying to insert a field with null but i am getting error of Dupliacte record ,Using API 8.0
 
 
Hi
I am trying to use sfdc AJAX 8.0 with .net 2005. Can anyone help me out inorder to how should i use it. I have used the
following script tag and has included the same in the aspx page as below:
 
<script src="https://na1.salesforce.com/soap/ajax/8.0/connection.js" type="text/javascript"></script>
 
Also inorder to test the ajax utlity i have added the following code in the <Head> tag.
 
<script type="text/javascript">
        function setup()
        {
            var callback = {onSuccess: display, onFailure: failed};
            var lr = sforce.connection.login(Username,password);
            var userInfo = sforce.connection.getUserInfo(callback);
        }
        function display(userInfo) {
            var doc = document.getElementById("name-span");
            doc.innerHTML = userInfo.userName;
        }
        function failed(error) {
            document.getElementById("name-span").innerHTML =
               error.toString();
        }
      </script>
 
In the body i have called the setup function as below
 
<body onload="setup()">
     Hi there! <span id="name-span"></span>
    <form id="form1" runat="server">
    <div>
       
    </div>
    </form>
</body>

This what i have found on one of the samples on community, but it doesn't seems to be working. Please help me out as how should i make use of AJAX. Also is there any way where we can call this from a simple HTML page. Do we need API support to use AJAX or is it the reference script that will make it all. Any suggestion and help would be appreciated.

Hi,

We are facing a problem in updating Sales Price for an Opportunity Line Item.

As per the API document the label Sales Price on the screen represents field Unit Price in Opportunity Line Item Object.(Is this correct??)

We are making an API call to update a few custom fields along with Unit Price. Other Fields are getting updated but Unit Price is not getting updated. Our objective is to set Sales Price to a value equal to value of a Custom Field.

Is there some catch into it that we are missing?

Any help would be appreciated.

Hi,

 There is a problem in getting the dates. I update the Opportunity table and insert the ADI_Last_Calculated_date as the Server Timestamp and at the same time SalesForce updates the last modified date for the opportunity. So there is difference in the Time. Can anyone suggest why is it so? I have tried using different date formats.

***********************************Function Description*********************************

Public Function updateRevenueToOpportunity(ByVal ID As String, ByVal Opp_ExpTotalValue As Integer, ByVal Opp_TotalValue As Integer, ByVal Opp_PeakAnnualValue As Integer, ByVal Opp_ExpPeakAnnualValue As Integer)

Dim saveResults() As SaveResult

Dim updateOpp As sObject = New sObject

Dim ilength = 0, iError As Integer = 0

Dim xElemnt(6) As System.Xml.XmlElement

Dim Doc As New System.Xml.XmlDocument

Try

xElemnt(0) = Doc.CreateElement("ADI_Expected_Total_Amount__c")

xElemnt(0).InnerText = Opp_ExpTotalValue

xElemnt(1) = Doc.CreateElement("ADI_Total_Amount__c")

xElemnt(1).InnerText = Opp_TotalValue

xElemnt(2) = Doc.CreateElement("ADI_Peak_Annual_Amount__c")

xElemnt(2).InnerText = Opp_PeakAnnualValue

xElemnt(3) = Doc.CreateElement("ADI_Expected_Peak_Annual_Amount__c")

xElemnt(3).InnerText = Opp_ExpPeakAnnualValue

xElemnt(4) = Doc.CreateElement("ADI_Last_Calculated_Date__c")

xElemnt(4).InnerText = Replace(Format(objService.getServerTimestamp.timestamp, "yyyy-MM-ddThh:mm:ss.millisZ"), "illi", "", 1)

xElemnt(5) = Doc.CreateElement("ADI_Generate_Forecast__c")

xElemnt(5).InnerText = "False"

updateOpp.Id = ID

updateOpp.Any = xElemnt

updateOpp.type = "Opportunity"

saveResults = objService.update(New SFPartner.sObject() {updateOpp})

Dim Err As [Error]

While (ilength < saveResults.Length)

If saveResults(ilength).success Then

_Logger.LogInfo("OpportunityLineItem successfully updated with " + saveResults(ilength).id + " as the ID")

Else

While (iError < saveResults(ilength).errors.Length)

Err = saveResults(ilength).errors(iError)

_Logger.LogError("Opportunity Line Item could not be updated : '" + Err.message + "'", "updateRevenueToOpportunitylineItem")

iError = iError + 1

End While

End If

ilength = ilength + 1

End While

Catch ex As Exception

Throw New Exception("Failed to update Opportunity")

End Try

End Function

*************************************Output Result***************************************

OpportunityID - 006000000077XUuAAM  

LastModifiedDate - 5/19/2005 5:01 PM   

Name - Punit Opportunity 1 Product

ADI_Last_Calculated_date  -  5/19/2005 10:31 AM