Fórumok
Adding PollsQuestion programmatically
Nilesh Nemichand Gundecha, módosítva 13 év-val korábban
Adding PollsQuestion programmatically
Regular Member Bejegyzések: 205 Csatlakozás dátuma: 2009.12.01. Legújabb bejegyzések
Hi Friends,
I am struggling to add one simple PollsQuestion along with 2 choices.
I tried to do below for same -
Now here I come and stuck up at creating List<PollsChoice> object. I checked PollsChoiceLocalServiceUtil class, but for creating/adding PollsChoice you again need wither questionId or PollsQuestion object.
Cant make out what I am missing. Please help.
Regards,
Nilesh.
I am struggling to add one simple PollsQuestion along with 2 choices.
I tried to do below for same -
Map<locale, string> titleMap = new HashMap<locale, string>();
titleMap.put(request.getLocale(), "Idea Polls");
Map<locale, string> descriptionMap = new HashMap<locale, string>();
descriptionMap.put(request.getLocale(), "Do you like this Idea");
Calendar cal = Calendar.getInstance();
long pollQuestionId = PollsQuestionLocalServiceUtil.addQuestion(ideatorId, titleMap , descriptionMap, cal.get(2), cal.get(5), cal.get(1), cal.get(11), cal.get(12), true, [color=#D41313]choices[/color], serviceContext);
</locale,></locale,></locale,></locale,>
Now here I come and stuck up at creating List<PollsChoice> object. I checked PollsChoiceLocalServiceUtil class, but for creating/adding PollsChoice you again need wither questionId or PollsQuestion object.
Cant make out what I am missing. Please help.
Regards,
Nilesh.
Himanshu Bhandari, módosítva 8 év-val korábban
RE: Adding PollsQuestion programmatically
Regular Member Bejegyzések: 148 Csatlakozás dátuma: 2014.05.09. Legújabb bejegyzések
Hi
Polls choice is related to Question, so questionId is required to relate them. When you create a new question by passing it an ID, you need to pass the same ID to the choices while creating them.
Thanks.
but for creating/adding PollsChoice you again need wither questionId or PollsQuestion object.
Polls choice is related to Question, so questionId is required to relate them. When you create a new question by passing it an ID, you need to pass the same ID to the choices while creating them.
Thanks.