• asdfg
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 6
    Replies
Hi,
      I have a situation where i need to log in as two different users to test my code, Also with this I need that the both the users should belong to the same territory.
 
I am using run as method to log in as two different users, but was not able to associate these users to the territory.
Is there any way i can do this, failing to which i am forced to hard code the system users which i know is not the best practise to write any test methods.
 
Any idea of yours is much appriciated.
 
Thanks,
Sanjay
  • November 23, 2008
  • Like
  • 0
Hi Everyone,
                         I have been stuck at a point for a long time. Kindly help me out.

1. I have created a Apex Page (Tab) where I am Displaying all the Activities in a list view, Now, when i click on the Subject (Hyperlinked with Event Id), The Page URL still remains that of the Previous Page. I have created a Apex Detail page for "Event" where i need to use the Event Id for displaying Additional details. 

In the second Page "Event" I am using 
ApexPages.currentPage().getParameters().get('id') for capturing the Id of the Event. But this
is not working as the previous page never returned the Event Id in the URL.

Please Let me know, If from the List view, How i can get the Normal Salesforce Url as lik : http://salesforce.com/00UT0000001WcC9

Below are my Attached Code. Page Code -



Code:
<apex:page Controller="CallCode" tabstyle="Event">
<apex:form >
<apex:pageBlock Title="Activity/Event Management" mode="view">
<apex:pageBlockButtons location="Top">
<apex:selectList value="{!ActivityType}" size="1">
<apex:selectOptions value="{!items}"/>
</apex:selectList>
<apex:commandButton value="Create" action="{!Submit}"/><p/>
</apex:pageBlockButtons>
<apex:selectList id="CallsListView" value="{!ListCalls}" size="1" onChange="{!allcalls}">
<apex:selectOption itemValue="My Calls" itemLabel="My Activities / Events">
</apex:selectOption>
</apex:selectList>
<apex:outputPanel id="out">
<apex:actionstatus id="status" startText="Loading Calls....">
<apex:facet name="stop">
<apex:outputPanel >
<apex:pageBlockTable value="{!allcalls}" var="call">

<apex:column >
<apex:facet name="header"><strong>Subject</strong></apex:facet>
<apex:commandLink action="{!go}" rerender="form">
{!call.Subject}
<apex:param name="id" value="{!call.Id}"/>
</apex:commandLink>
</apex:column>

<apex:column value="{!call.whatid}"/>
<apex:column value="{!call.Id}"/>
<apex:column value="{!call.StartDateTime}"/>
<apex:column value="{!call.EndDateTime}"/>

</apex:pageBlockTable>
</apex:outputPanel>
</apex:facet>
</apex:actionstatus>
</apex:outputPanel>
</apex:pageblock>
</apex:form>
</apex:page>

 
ActivityTab
Code:
public class CallCode
{
public PageReference go()
{
PageReference pageRef = new PageReference('https://tapp0.salesforce.com/'+System.currentPageReference().getParameters().get('id'));
pageRef.setRedirect(true);
return pageRef;
}
Event[] callList;
public Event[] getAllCalls()
{
callList = [select id,subject,ActivityDate, whatid,ownerid,whoid, StartDateTime, EndDateTime, Region__c, Division__c from Event where OwnerId = :UserInfo.getUserId() order by Activitydate Desc Limit 10 ];
return callList;
}
String s;
public String getListCalls()
{
return s;
}
public void setListCalls(String s)
{
this.s = s;
}
String ActivityType = null;
public PageReference test()
{
return null;
}
public List<SelectOption> getItems()
{
List<SelectOption> options = new List<SelectOption>(); options.add(new
SelectOption('012T00000004QEt','Branch/Office Visits'));
options.add(new SelectOption('012T00000004QGV','Case Development Meetings'));
options.add(new SelectOption('012T00000004R6o','Client/Prospect Meeting'));
options.add(new SelectOption('012T00000004R6t','Day at the Firm'));
options.add(new SelectOption('012T00000004R6u','Desktop Application Plan Presentation'));
options.add(new SelectOption('012T00000004QEy','FA/PB visit'));
options.add(new SelectOption('012T00000004R6v','Meeting with Low Adopters'));
options.add(new SelectOption('012T00000004R6w','Planning Center Presentation'));
options.add(new SelectOption('012T00000004R6y','VIP Meeting'));
options.add(new SelectOption('012T00000004R73','Collaboration with Specialists'));
options.add(new SelectOption('012T00000004R6z','FPDA Account'));
options.add(new SelectOption('012T00000004R70','Recruit Meeting'));
options.add(new SelectOption('012T00000004R6p','Regional Activity'));
options.add(new SelectOption('012T00000004REY','Management Meeting'));
options.add(new SelectOption('012T00000004R74','Specialist Professional Development'));
options.add(new SelectOption('012T00000004R79','Specialist-lead Seminar/Training'));
return options;
}
public String getActivityType()
{
return ActivityType;
}
public PageReference submit()
{
String ActivityRecordType = ActivityType;
System.debug(ActivityRecordType);
PageReference pageRef = new PageReference('https://tapp0.salesforce.com/00U/e—retURL=/home/home.jsp&RecordType='+ActivityRecordType+'&cancelURL=/apex/Activity–sfdc.tabName=01rT0000000CqDx&sfdc.motif=Custom14&ent=Event');
return pageRef;
}
public void setActivityType(String ActivityType)
{
this.ActivityType= ActivityType;
}
}


Event Detail Page -

Code:
<apex:page standardController="Event" extensions="MyCustomEvent">
<apex:detail />
<apex:pageblock title="FA/PB Related List">
<apex:pageBlockTable value="{!FA_Branch}" var="Temp">
<apex:column value="{!Temp.FA_PB_Name__c}"></apex:column>
<apex:column value="{!Temp.FA_PB_Branch_Id__c}"></apex:column>
<apex:column value="{!Temp.FA_PB_Branch__c}"></apex:column>
<apex:column value="{!Temp.Name}"></apex:column>
</apex:pageBlockTable>
</apex:pageblock>

<apex:pageblock title="Branch Related List">
<apex:pageBlockTable value="{!Branch}" var="Temp1">
<apex:column value="{!Temp1.Branches__c}"></apex:column>
<apex:column value="{!Temp1.Branch_Division__c}"></apex:column>
<apex:column value="{!Temp1.Branch_Region__c}"></apex:column>
<apex:column value="{!Temp1.Name}"></apex:column>
</apex:pageBlockTable>
</apex:pageblock>

</apex:page>

 Event Controller -
Code:
public class MyCustomEvent 
{
public MyCustomEvent(ApexPages.StandardController controller)
{
}
FA_Branch__c[] MyFA_BranchId;
public FA_Branch__c[] getFA_Branch()
{
String WhatIds = ApexPages.currentPage().getParameters().get('whatid');
MyFA_BranchId = [select id,Name, Branch_Division__c, Branch_Region__c, FA_PB_Branch_Id__c, FA_PB_Branch__c, FA_PB_Name__c, Branches__c from FA_Branch__c where Branch__c = :ApexPages.currentPage().getParameters().get('id') and FA_PB_Name__c !=''];
return MyFA_BranchId;
}

FA_Branch__c[] My_BranchId;
public FA_Branch__c[] getBranch()
{
String WhatIds = ApexPages.currentPage().getParameters().get('whatid');
My_BranchId = [select id,Name, Branch_Division__c, Branch_Region__c, FA_PB_Branch_Id__c, FA_PB_Branch__c, Branches__c from FA_Branch__c where Branch__c = :ApexPages.currentPage().getParameters().get('id') and Branches__c !=''];
return My_BranchId;
}
}


Thank to you all in Advance....

Sanjay
 


  • August 15, 2008
  • Like
  • 0
Hi Everyone,
                         I have been stuck at a point for a long time. Kindly help me out.

1. I have created a Apex Page (Tab) where I am Displaying all the Activities in a list view, Now, when i click on the Subject (Hyperlinked with Event Id), The Page URL still remains that of the Previous Page. I have created a Apex Detail page for "Event" where i need to use the Event Id for displaying Additional details. 

In the second Page "Event" I am using 
ApexPages.currentPage().getParameters().get('id') for capturing the Id of the Event. But this
is not working as the previous page never returned the Event Id in the URL.

Please Let me know, If from the List view, How i can get the Normal Salesforce Url as lik : http://salesforce.com/00UT0000001WcC9

Below are my Attached Code. Page Code -



Code:
<apex:page Controller="CallCode" tabstyle="Event">
<apex:form >
<apex:pageBlock Title="Activity/Event Management" mode="view">
<apex:pageBlockButtons location="Top">
<apex:selectList value="{!ActivityType}" size="1">
<apex:selectOptions value="{!items}"/>
</apex:selectList>
<apex:commandButton value="Create" action="{!Submit}"/><p/>
</apex:pageBlockButtons>
<apex:selectList id="CallsListView" value="{!ListCalls}" size="1" onChange="{!allcalls}">
<apex:selectOption itemValue="My Calls" itemLabel="My Activities / Events">
</apex:selectOption>
</apex:selectList>
<apex:outputPanel id="out">
<apex:actionstatus id="status" startText="Loading Calls....">
<apex:facet name="stop">
<apex:outputPanel >
<apex:pageBlockTable value="{!allcalls}" var="call">

<apex:column >
<apex:facet name="header"><strong>Subject</strong></apex:facet>
<apex:commandLink action="{!go}" rerender="form">
{!call.Subject}
<apex:param name="id" value="{!call.Id}"/>
</apex:commandLink>
</apex:column>

<apex:column value="{!call.whatid}"/>
<apex:column value="{!call.Id}"/>
<apex:column value="{!call.StartDateTime}"/>
<apex:column value="{!call.EndDateTime}"/>

</apex:pageBlockTable>
</apex:outputPanel>
</apex:facet>
</apex:actionstatus>
</apex:outputPanel>
</apex:pageblock>
</apex:form>
</apex:page>

 
ActivityTab
Code:
public class CallCode
{
public PageReference go()
{
PageReference pageRef = new PageReference('https://tapp0.salesforce.com/'+System.currentPageReference().getParameters().get('id'));
pageRef.setRedirect(true);
return pageRef;
}
Event[] callList;
public Event[] getAllCalls()
{
callList = [select id,subject,ActivityDate, whatid,ownerid,whoid, StartDateTime, EndDateTime, Region__c, Division__c from Event where OwnerId = :UserInfo.getUserId() order by Activitydate Desc Limit 10 ];
return callList;
}
String s;
public String getListCalls()
{
return s;
}
public void setListCalls(String s)
{
this.s = s;
}
String ActivityType = null;
public PageReference test()
{
return null;
}
public List<SelectOption> getItems()
{
List<SelectOption> options = new List<SelectOption>(); options.add(new
SelectOption('012T00000004QEt','Branch/Office Visits'));
options.add(new SelectOption('012T00000004QGV','Case Development Meetings'));
options.add(new SelectOption('012T00000004R6o','Client/Prospect Meeting'));
options.add(new SelectOption('012T00000004R6t','Day at the Firm'));
options.add(new SelectOption('012T00000004R6u','Desktop Application Plan Presentation'));
options.add(new SelectOption('012T00000004QEy','FA/PB visit'));
options.add(new SelectOption('012T00000004R6v','Meeting with Low Adopters'));
options.add(new SelectOption('012T00000004R6w','Planning Center Presentation'));
options.add(new SelectOption('012T00000004R6y','VIP Meeting'));
options.add(new SelectOption('012T00000004R73','Collaboration with Specialists'));
options.add(new SelectOption('012T00000004R6z','FPDA Account'));
options.add(new SelectOption('012T00000004R70','Recruit Meeting'));
options.add(new SelectOption('012T00000004R6p','Regional Activity'));
options.add(new SelectOption('012T00000004REY','Management Meeting'));
options.add(new SelectOption('012T00000004R74','Specialist Professional Development'));
options.add(new SelectOption('012T00000004R79','Specialist-lead Seminar/Training'));
return options;
}
public String getActivityType()
{
return ActivityType;
}
public PageReference submit()
{
String ActivityRecordType = ActivityType;
System.debug(ActivityRecordType);
PageReference pageRef = new PageReference('https://tapp0.salesforce.com/00U/e—retURL=/home/home.jsp&RecordType='+ActivityRecordType+'&cancelURL=/apex/Activity–sfdc.tabName=01rT0000000CqDx&sfdc.motif=Custom14&ent=Event');
return pageRef;
}
public void setActivityType(String ActivityType)
{
this.ActivityType= ActivityType;
}
}


Event Detail Page -

Code:
<apex:page standardController="Event" extensions="MyCustomEvent">
<apex:detail />
<apex:pageblock title="FA/PB Related List">
<apex:pageBlockTable value="{!FA_Branch}" var="Temp">
<apex:column value="{!Temp.FA_PB_Name__c}"></apex:column>
<apex:column value="{!Temp.FA_PB_Branch_Id__c}"></apex:column>
<apex:column value="{!Temp.FA_PB_Branch__c}"></apex:column>
<apex:column value="{!Temp.Name}"></apex:column>
</apex:pageBlockTable> 
</apex:pageblock>

<apex:pageblock title="Branch Related List">
<apex:pageBlockTable value="{!Branch}" var="Temp1">
<apex:column value="{!Temp1.Branches__c}"></apex:column>
<apex:column value="{!Temp1.Branch_Division__c}"></apex:column>
<apex:column value="{!Temp1.Branch_Region__c}"></apex:column>
<apex:column value="{!Temp1.Name}"></apex:column>
</apex:pageBlockTable> 
</apex:pageblock>

</apex:page>

 Event Controller -
Code:
public class MyCustomEvent 
    {
    public MyCustomEvent(ApexPages.StandardController controller) 
        {
        }
    FA_Branch__c[] MyFA_BranchId;
    public FA_Branch__c[] getFA_Branch() 
        {
        String WhatIds = ApexPages.currentPage().getParameters().get('whatid');
        MyFA_BranchId = [select id,Name, Branch_Division__c, Branch_Region__c, FA_PB_Branch_Id__c, FA_PB_Branch__c, FA_PB_Name__c, Branches__c from FA_Branch__c where Branch__c = :ApexPages.currentPage().getParameters().get('id') and FA_PB_Name__c !=''];
        return MyFA_BranchId;
        }
  
    FA_Branch__c[] My_BranchId;
    public FA_Branch__c[] getBranch() 
        {
        String WhatIds = ApexPages.currentPage().getParameters().get('whatid');
        My_BranchId = [select id,Name, Branch_Division__c, Branch_Region__c, FA_PB_Branch_Id__c, FA_PB_Branch__c, Branches__c from FA_Branch__c where Branch__c = :ApexPages.currentPage().getParameters().get('id') and Branches__c !=''];
        return My_BranchId;
        }        
    }


Thank to you all in Advance....

Sanjay
 


  • August 15, 2008
  • Like
  • 0
Hi,
       I need to have a component on Home Page which shous the daily exchange rates b/w AUD <-->USD.
Can anyone suggest me, how to go about this ?

I think the option can be S-Control , but any guidance would be great help.

Thanks in Advance,

  • November 12, 2007
  • Like
  • 0
Hi All,
            I need to change the record type of the record on the basis of the logged in User and some other conditions, My code works fine if previously the record type was none, but if it had some value then it does not work.

I saw the field level security and the field is editable.

the update result is also success, still not changing th record type.

Code:
var _Test = new sforce.SObject("Test__c");
 _Test.Id = "{!Test__c.Id}";
 _Test.RecordTypeId = "01220000000CskQMAS";
 try
 {
 var TestUpdate = sforce.connection.update([_Test]);
 }
 catch(err)
 {
 alert(err);
 } 
Someone please help.
  • November 07, 2007
  • Like
  • 0

Hi there,

I am trying to create a trigger on a custom object "VerwijderFnc__c" what deletes records in another custom object "Functionaris__c"

 

process is: insert a record into VerwijderFnc__c and get the Id from the Functionaris__c to delete those Functionaris__c record(s).

Sometimes i get more then 20 records as a result! and that is too much!

 

so i try to make this trigger bulksafe .... But i can't get ik to work for me !

This was 1e my code for the trigger: (NOT BULKSAFE)

 

trigger deleteFromFunctionaris on VerwijderFnc__c (before insert) {
     for(VerwijderFnc__c verwijdertabel: Trigger.new){
         for (Functionaris__c fs: [SELECT Id FROM Functionaris__c WHERE mskey__c = :verwijdertabel.MSkey__c]){
            //Delete all the Functionaris__c entries with given mskey__c
            delete fs;
         }
     }
}

 

then i tried something like: (BUT ALSO GIVES TOO MANYDML STATMENTS)

 

trigger deleteFromFunctionaris on VerwijderFnc__c (before insert) {

 

Map<String, VerwijderFnc__c> fncMap = new Map<String, VerwijderFnc__c>(); for (VerwijderFnc__c fnc : System.Trigger.new) {  if ((fnc.mskey__c != null) && (System.Trigger.isInsert || (fnc.mskey__c != System.Trigger.oldMap.get(fnc.Id).mskey__c))) {

fncMap.put(fnc.mskey__c, fnc);

}

}

 

for (Functionaris__c func : [SELECT Id FROM Functionaris__c WHERE mskey__c IN :fncMap.KeySet()]) { delete func;

}

}

 

 

 

!! Help !!

 

 

 

Message Edited by Streepeye on 03-31-2009 05:56 AM
Hi,
 
  I have webservice written in .net located on my machine (I could see the web page located in same directory from URL type s-control in salesforce. so that means salesforce can access the files from that directory.)  I generated APex class from the WSDL(had to remove soap12 bindings).
 
//Generated by wsdl2apex
public class tempuriOrg {
    public class HelloWorld_element {
        public String arg;
        private String[] arg_type_info = new String[]{'arg','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true'};
        private String[] field_order_type_info = new String[]{'arg'};
    }
    public class testSalesForceSoap {
        public String endpoint_x = 'http://machineName/virtualdirectoryname/testSalesForce.asmx';
        private String[] ns_map_type_info = new String[]{'http://tempuri.org/', 'tempuriOrg'};
        public String HelloWorld(String arg) {
            tempuriOrg.HelloWorld_element request_x = new tempuriOrg.HelloWorld_element();
            tempuriOrg.HelloWorldResponse_element response_x;
            request_x.arg = arg;
            Map<String, tempuriOrg.HelloWorldResponse_element> response_map_x = new Map<String, tempuriOrg.HelloWorldResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://tempuri.org/HelloWorld',
              'http://tempuri.org/',
              'HelloWorld',
              'http://tempuri.org/',
              'HelloWorldResponse',
              'tempuriOrg.HelloWorldResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.HelloWorldResult;
        }
    }
    public class HelloWorldResponse_element {
        public String HelloWorldResult;
        private String[] HelloWorldResult_type_info = new String[]{'HelloWorldResult','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true'};
        private String[] field_order_type_info = new String[]{'HelloWorldResult'};
    }
}
 
 
then I wrote wrapper apex class to call the apex code generated.
 
global class testSalesforce{
WebService static string test1(string name) {
tempuriOrg.testSalesForceSoap soap = new tempuriOrg.testSalesForceSoap();
return soap.HelloWorld('hello world !!! ' + name);}}
 
Then I created s-control to call this new webservice.
 
<html>
<head>
<script type="text/javascript" src="/js/functions.js"></script>
<script src="/soap/ajax/10.0/connection.js"></script>
<script src="/soap/ajax/10.0/apex.js"></script>
<script>
function X() {
try{
var result = sforce.apex.execute("testSalesforce" ,"test1", {arg:" hello"});
}
 catch (ex)
      {
       alert ("Failed : " + ex);
      }
}
</script>
</head>
<body onload=X()>
 <div id=userNameArea></div>
</body>
</html>
 
In security controls/remote site settings I have http://machinename url provided.
 
I am invoking the s-control on custom button click. when I give machinename in endpoint_x, I am getting:
System.CalloutException: Web service
    callout failed: Unexpected element. Parser was expecting element
    'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found ':HTML'
 
and when I give ip address in endpoint_x and remote site settings I am getting :
IO Exception: Read Timed out
 
What do I need to do to get it working?
 
Thanks,


Message Edited by NewToSF on 04-01-2008 11:52 AM
Hi Everyone,
                     I have a requirement where i need to check the Owner Territory, and User Title Before Update,
The Previous owner can transfer the particualr opportuntiy to a new Owner if the Parent Territory of both (New Owner, Previous Owner) are same and the new user has title as "Special" .  A particular user can sit on  more then one territory. so only those users can be new owner which satisfy this condition.

I am new to Apex, i wrote something based on S-Control i saw on the community.
 
Code:
trigger NewOwner on Opportunity (before update, after update) 
{
//string profileid =UserInfo.getProfileId();
ID oppsid = Trigger.old[0].Id;
User[] PreviousOwner = [select id, profileid from User where id=:Trigger.old[0].OwnerId Limit 1];
//String OwnerId = user.Id[0];
if(PreviousOwner[0].ProfileId =='00eT0000000dnyE')
{
// Territory of the Owner
UserTerritory[] OwnerTerritory = [select Id, TerritoryId, IsActive from UserTerritory where UserId=:Trigger.old[0].OwnerId and IsActive = TRUE];
for(Integer i=0; i<OwnerTerritory.size(); i++)
{
// Parent Territory of the Owner
Territory[] OwnerParentTerritory = [select Id, Name, ParentTerritoryID from Territory where Id=:OwnerTerritory[i].TerritoryId];
for (Integer j=0; j<OwnerParentTerritory.size(); j++)
{
// Get the New User's Id and Title.
User[] NewOwner = [select Id, Title from User where id=:Trigger.new[0].OwnerId Limit 1];
// To get the New User's Territory
UserTerritory[] NewOwnerTerritory = [select Id, TerritoryId, IsActive from UserTerritory where UserId =:Trigger.new[0].OwnerId and IsActive = TRUE];
Territory[] NewOwnerParentTerritory = [select Id, Name, ParentTerritoryID from Territory where Id=:NewOwnerTerritory[0].TerritoryId];
for(Integer k=0; k<NewOwnerParentTerritory.size(); k++)
if(NewOwner[0].Title == 'Special' && NewOwnerParentTerritory[k].ParentTerritoryID == OwnerParentTerritory[j].ParentTerritoryID)
{
UserTerritory[] OldOwner = [select TerritoryId, UserId from UserTerritory where UserId=:Trigger.old[0].OwnerId and IsActive = TRUE];
for(Integer l=0; l<OldOwner.size(); l++)
{
for(UserTerritory OldOwnerTerritoryUsers:[select UserId from UserTerritory where TerritoryId=:OldOwner[l].TerritoryId and IsActive = TRUE])
{
OpportunityShare oppsshare = new OpportunityShare();
oppsshare.OpportunityId = oppsid ;
oppsshare.UserOrGroupId = OldOwnerTerritoryUsers.UserId;
oppsshare.OpportunityAccessLevel = 'Read';
try
{
insert oppsshare ;
}
catch (Exception e)
{
System.debug(e.getMessage());
}
}
}
}
/*else
{
Trigger.new[0].OwnerId.addError('Deal can only be assigned to User in your parent territory and with title as Special');
}
*/
}
}
}
}
}

The trigger saved and also is valid but at the time of Operation, i recieve this error message.
Error - Apex trigger: NewOwner caused an unexpected exception, contact your administrator: NewOwner: execution of BeforeUpdate caused by: System.ListException: List index out of bounds: 0: Trigger.NewOwner

Error: Apex trigger NewOwner caused an unexpected exception, contact your administrator: NewOwner: execution of AfterUpdate caused by: System.Exception: Too many SOQL queries: 21: Trigger.NewOwner: line 18, column 19

If someone can please help me with this, would be great help.
Many Thanks in Advance.
Developer118


Message Edited by Developer118 on 02-12-2008 02:16 PM

Message Edited by Developer118 on 02-12-2008 02:17 PM
I have seen many questions concerning the ability to change an opportunity name utilizing an S-control, but no one seams to have made on work completely.  I would like to be able to combine the Opportunity "Type" and a custom filed value to make up the opportunity name with an s-control.
  • November 10, 2007
  • Like
  • 0
Hi All,
            I need to change the record type of the record on the basis of the logged in User and some other conditions, My code works fine if previously the record type was none, but if it had some value then it does not work.

I saw the field level security and the field is editable.

the update result is also success, still not changing th record type.

Code:
var _Test = new sforce.SObject("Test__c");
 _Test.Id = "{!Test__c.Id}";
 _Test.RecordTypeId = "01220000000CskQMAS";
 try
 {
 var TestUpdate = sforce.connection.update([_Test]);
 }
 catch(err)
 {
 alert(err);
 } 
Someone please help.
  • November 07, 2007
  • Like
  • 0
I am developing an addin that uses the Office Toolkit v3.0 and have installed the toolkit and the salesforce plugin that has the basic functionality of logging in, logging out, inserting merge fields, along with help, support, and about.  What I want to do is get access to the code for this plugin so i can modify it to add extra menu items for the functionality i want to add.
 
But when I try to browse the source or look at it from within vba, it says the project is locked and unviewable.  Is there any way to unlock this so i can see the code or do i have to write my own custom plugin that duplicates the functionality of that which is in the salesforce plugin (i.e. login, logout, etc)?