Deleting the records in web application | Adobe Higher Education
Skip to main content
Level 4
March 14, 2024
Resuelto

Deleting the records in web application

  • March 14, 2024
  • 1 respuesta
  • 1515 visualizaciones

Hello team 
I just want to delete the records which has imagelink,review and auto pk attribute 

when i click on the no button the particular record has to delete in schema 

can anyone provide idea for that and shall we add that logic in within a page activity or i need to use javascript code activity to declare the condition

 

 

Este tema ha sido cerrado para respuestas.
Mejor respuesta de AkshayAnand

Hi @vani97 

 

You could use as :-

xtk.session.DeleteCollection( "nms:recipient", <where> <condition expr="[@id] = '+vars.ID+'"/> </where>, false )

 

May I ask if the the provision to delete is just once or upon selecting 'NO" the WebApp will show next image?.

If only once then you can define a variable ti store that ID and use the XML in JS code to delete. If multiple you could define a dynamic array and use it for looping in the JS code.

You could also try the approach of creating a loop within the 2 activities, ie, Page and JS activity. For instance, we a cust selects "No" a flagVariable will be update to 1 and go to JS activity, where it will delete the single record using XML code. After this a test activity can check the flagVariable, if it's equal to 1 then the transition will land back to the page activity hence reloading the page with different image and so on.

Just few suggestion, you can absolutely modify it according to your use case.

 

Thanks

Akshay

1 respuesta

AkshayAnand
Community Advisor
Community Advisor
March 15, 2024

Hi @vani97 

 

You can use the delete collection method to delete the records collected from your JSSP pages. For reference you can visit this page.

 

Regards

Akshay

vani97Autor
Level 4
March 15, 2024

Hi 

 

Based on the primary key i supposed to delete when i click on the no button 

As i refered in document i got this 

xtk.session.DeleteCollection(
    "nms:recipient",
    <where>
        <condition expr="[@email] = 'isabel.garcia@mycompany.com'"/>
    </where>,
    false
    )

 As this condition is not needed in my case .how the transition would be could you kindly guide!

and should we need to include this in javascript activity or with in a page can we able to add this

vani97Autor
Level 4
March 15, 2024

Hi @vani97 

 

You could use as :-

xtk.session.DeleteCollection( "nms:recipient", <where> <condition expr="[@id] = '+vars.ID+'"/> </where>, false )

 

May I ask if the the provision to delete is just once or upon selecting 'NO" the WebApp will show next image?.

If only once then you can define a variable ti store that ID and use the XML in JS code to delete. If multiple you could define a dynamic array and use it for looping in the JS code.

You could also try the approach of creating a loop within the 2 activities, ie, Page and JS activity. For instance, we a cust selects "No" a flagVariable will be update to 1 and go to JS activity, where it will delete the single record using XML code. After this a test activity can check the flagVariable, if it's equal to 1 then the transition will land back to the page activity hence reloading the page with different image and so on.

Just few suggestion, you can absolutely modify it according to your use case.

 

Thanks

Akshay


Hi

Thanks for the detailed explanation and i supposed to delete multipe image.as you shwn here supposed to do multiple rejects
could kindly guide me further and ill try out your explanation



this condtion should follwed here right ?

for the deletion 

xtk.session.DeleteCollection(
    "nms:recipient",
    <where>
        <condition expr="[@id] = '+vars.ID+'"/>
    </where>,
    false
    )