cancel
Showing results for 
Search instead for 
Did you mean: 

Submitting a document to approval workflow automatically

Former Member
0 Kudos

Hi Gurus,

I want to submit a XML form directly for approval without anyone

going to submit for approval.

I have gone thru the forums, have conjured that a repository service needs to be written.

i wrote that, this is the code.

protected void addRepositoryAssignment(IRepositoryManager mgr) throws ServiceNotAvailableException {
    // Implement this method: Usually the service registers itself for certain events at the repository manager.
	try{
		 mgr.getEventBroker().register(this, new ResourceEvent(ResourceEvent.CREATE_CHILD, null));
	 }catch(WcmException e){
	 }





 public void received(IEvent event) {
	IResource resource = (IResource)event.getParameter();
	
		try{			
		//	get the statemanagement service from the resource
					   IRepositoryServiceFactory factory = ResourceFactory.getInstance().getServiceFactory();
					   IStatemanagementManager statemanagement =
					   (IStatemanagementManager)factory.getRepositoryService(resource, IWcmConst.STATEMANAGEMENT_SERVICE);

					   IStatemanagementResource sResource =
					   statemanagement.getStatemangementResource(resource);


					   IResourceTransition transition = sResource.getTransition("lbl.submit");
//						 if everything is correct than transition is not null
					   if (transition != null) 
					   
					  
					   {transition.execute(); 
						
					
					   }
		}catch(Exception e){
			e.printStackTrace();
		}

These are the following issues coming up.

1)

I have deployed and activated this service for the required repository.

When i restart the server there is no efffect, if i create a document it still gets created in "in progress" status.

But i can manually start the approval process.

I have already got one sample service running which renames all the files created.

I am on EP 7.0 SPS 16

2)

One more issue i noticed is that if i deploy the service and i dont restart the server I am unable to start the approval process even manually.

It throws me an error like

Could not execute command 'com.sapportals.wcm.rendering.uicommand.cm.UIStatemanagementCommand'

Could anyone please throw some light as to why this is happening or why the service isnt working, since everywhere on the forums i saw this is the code which is functional.

Any help would be appreciated.

Thanks and Regards,

Nikhil

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

No i have not created a schedular service.

My requirement is that whenever a document is created in a particular repository it should be submitted for approval without anyone doing it manually.

Hence i have written the above repository service which listen to the event that a document is created.

The problem is that listening to the event is not a problem

since i can see the change in the name.

I have explained the issues in my first post.

Regards,

Nikhil

Former Member
0 Kudos

Hi Nikhil,

I have the same requirement!

Have you been successful achieving this requirement,

if yes... request you to kindly help me achieving this requirement.

Many Thanks,

SK

Former Member
0 Kudos

Hi!

Check this Note:

SAP Note Number: 1439075

I had the same problem and the solution of the note solved it.

Regards,

Nicolá

Former Member
0 Kudos

Hi,

Have u created schedullar service?

If yes then,

In IRFServiceWrapper.java u want to set Key value

like,

public static final String KEY = "YourPackageName.YourClassName";

Points are welcome

regards,

Kathiresan R