It's all about the answers!

Ask a question

Not able to set asset state to "approved" in iRAM

Preetam Sikdar (61316) | asked Jan 31 '14, 6:28 a.m.
I am doing to set an asset status from draft to approved state.
When i am going to set the Approved state it showing an error message
Code snippet:
                    RAMAsset ramAsset =(RAMAsset)assets[k].getAsset();
                    String currState = ramAsset.getStateName().trim();
                    if(currState != null && currState.equalsIgnoreCase("Draft"))
                        String assetId = ramAsset.getGUID();
                        RAMAction  ramActions1 = ramAsset.getAction();
                            for (int j =0;j<1;j++)
                                 System.out.println("Asset Id: "+ assetId+" Asset Name: "+ramAsset.getName());

Error message showing when it going to setStateName

Number of Draft Assets: 1525 The asset state can only be set by the server.
    at Catgory.CategorizeApprove.main(

So can any please help me out to so that i can approve the assets .

One answer

permanent link
Rich Kulp (3.6k38) | answered Jan 31 '14, 9:38 a.m.
You can't directly set state. You must use the appropriate action to move to another state. Each state has a set of available actions, and each action then takes the asset to a different state.

See in the documentation for RAMAsset
There is getAvailableActions() to see what actions are available, and setAction() to set the action to perform when you send the asset for updating to the host.

Your answer

Register or to post your answer.