Jahia Dev Forum > access property...

2 (2 Good)
0 (0 Bad)

access property on node delete

by  bharatkasodariya »  2016/05/23 11:39

Need property of node during delete( for example  jcr:title)

Used rule "A node is deleted" to get the control on delete. It has param DeletedNodeFact but couldnt access property from it.
How to get deleted node's title from DeletedNodeFact

Is there any other rule should be used to access property of deleted node. Looking for the option to access property value of node which is going to delete.

  (bharatkasodariya)

Number of messages  57
Registration date
0 (0 Good)
0 (0 Bad)

Re: access property on node delete

by  ali.ghahraei@citi.com.mx »  2017/03/15 23:18

I'm trying to do the same. Is it possible?

  (ali.ghahraei@citi.com.mx)

Number of messages  4
Registration date
1 (1 Good)
0 (0 Bad)

Re: Re: access property on node delete

by  bharatkasodariya »  2017/03/16 10:32

you can add publish rule. when its published after deletion, can check weather that node is marked for delete or not. If its marked delete then you can put your logic there, node will have all data.

  (bharatkasodariya)

Number of messages  57
Registration date
0 (0 Good)
0 (0 Bad)

Re: Re: Re: access property on node delete

by  ali.ghahraei@citi.com.mx »  2017/03/24 22:10

Thank you! That was very helpful and I managed to access the node, but now I can't match when a new node is published. I match a deleted node like this:

rule "An iterable has been deleted"
  when
    A node is published
      - the node has the type sols:iterable
>   $publishedNodeFact : PublishedNodeFact( )
>   eval($publishedNodeFact.getNode().isMarkedForDeletion())
  then
    Log "Updating references in previous and next nodes of iterable: " + node.getName()
    Update references in neighbors of iterable node
end

 

I want to do the same for a new node in another rule, but I can't find how to do it. I tried with isNew(), but it didn't work. Do you have any ideas?

  (ali.ghahraei@citi.com.mx)

Number of messages  4
Registration date
0 (0 Good)
0 (0 Bad)

Re: access property on node delete

by  bharatkasodariya »  2017/03/25 04:49

cant you put inverse rule. in not marked delete.

!$publishedNodeFact.getNode().isMarkedForDeletion()

  (bharatkasodariya)

Number of messages  57
Registration date
Contact
Share
Feedback

Get in touch

Whether you are a current user or if you are just evaluating Jahia, we are here to help.

Contact us

Share this page