• ngunther
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies

I installed Wikiforce without incident onto a sandbox.  I like what I saw and installed into production.  I followed the instructions per the Google Code page.  I set the override on the Wiki tab to the Wiki Overview VisualForce page. When I go to that tab or page, it says that the page is not there.  ...I see the page in pages (wf_WikiOverview).

 

Thanks

Guys,

I've been trying to properly generate java code from the wsdl schema for the past few days and no luck at all or partially functional. I am trying to use the axis 1.4, but I am not able to configure it properly so it generates the right java syntax.

If anyone has it set up and is willing to help would be appreciated I will send my wsdl over email.

Thanks in advance.

  • December 22, 2008
  • Like
  • 0
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