How to create action on document that opens page returned from webscript

cancel
Showing results for 
Search instead for 
Did you mean: 
lex91
Active Member II

How to create action on document that opens page returned from webscript

Jump to solution

I know this must be something simple but I can't seem to find the solution.

I have a custom webscript which returns a html page accessible by going to a url like so:

http://localhost:8080/alfresco/s/sts/report?nodeRef=workspace://SpacesStore/9b7ae522-75ae-4960-b579-...  

The only argument the webscript needs is the nodeRef={nodeRef} argument.

What I want to do is create an entry in the Document Actions pane (available for every document) that will take me to the url with the nodeRef argument of the respective document. By document actions pane I mean this:

I'm guessing the solution lies with custom actions but I can't figure out how and where to define the action.

Btw, I used the alfresco maven sdk to create an all-in-one project. I plan to take the resulting amp files and install them into the production alfresco server.

Thank you!

// Edit

I managed to create an entry with an action of type:"link" and the following params:

<param name="href">/alfresco/s/sts/report?nodeRef={node.nodeRef}</param>
<param name="target">_blank</param>

The problem with this solution is it requires additional authentication for "/alfresco/s" (service). Is there a way to access my webscript from a share page so the user is already logged in?

For example: "localhost:8080/share/page/sts/report?nodeRef={node.nodeRef}"

1 Solution

Accepted Solutions
krutik_jayswal
Senior Member II

Re: How to create action on document that opens page returned from webscript

Jump to solution

If you would like to bypass an authentication from share you can use the proxy authentication URL.Using below url you can call any webscript from alfresco share and it will by pass the authentication..

http://localhost:8080/share/proxy +"alfresco webscript URL"

View solution in original post

10 Replies
krutik_jayswal
Senior Member II

Re: How to create action on document that opens page returned from webscript

Jump to solution

If you would like to bypass an authentication from share you can use the proxy authentication URL.Using below url you can call any webscript from alfresco share and it will by pass the authentication..

http://localhost:8080/share/proxy +"alfresco webscript URL"

lex91
Active Member II

Re: How to create action on document that opens page returned from webscript

Jump to solution

Thank you  for your response!

Unfortunately, this method is not working for me. I tried the following link: 

http://localhost:8080/share/proxy/sts/report...

Anything I put after .../share/proxy/ gives me "Invalid EndPoint Id:" error

I want to mention I am using an all-in-one alfresco maven sdk project and I defined my webscript in the platform/repo module.

krutik_jayswal
Senior Member II

Re: How to create action on document that opens page returned from webscript

Jump to solution

It should be 

http://localhost:8080/share/proxy/alfresco/sts/..................

lex91
Active Member II

Re: How to create action on document that opens page returned from webscript

Jump to solution

Yes, that was it! 

Thank you!

antonis
Member II

Re: How to create action on document that opens page returned from webscript

Jump to solution

So that how is your final action looks like? I am trying to do the same thing but I need to add a custom property value in the href any idea?

Something like this

<param name="href">www.google.com/{customModel:CustomProperty}</param>
<param name="target">_blank</param>
krutik_jayswal
Senior Member II

Re: How to create action on document that opens page returned from webscript

Jump to solution

You can use , [jsNode.properties.customModel_CustomProperty]..

Refer share-documentlibrary-config.xml for more details.

antonis
Member II

Re: How to create action on document that opens page returned from webscript

Jump to solution

<action id="alfresco.tutorials.doclib.action.goToGoogle1" icon="google" type="link" label="alfresco.tutorials.doclib.action.goToGoogle.label">

<param name="href">http://www.google.com/[jsNode.properties.dpl_sa]</param>
<param name="target">_blank</param>
</action>

model prefix: dpl 

property prefix/name: sa

By the way the model has been created by the share UI

krutik_jayswal
Senior Member II

Re: How to create action on document that opens page returned from webscript

Jump to solution

I mean {sNode.properties.customModel_CustomProperty}.....sorry for wrong bracket

antonis
Member II

Re: How to create action on document that opens page returned from webscript

Jump to solution

sNode or jsNode xD? where can I find a document about this systax?